Git Commands For Beginners

Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency

  1. git init: This command is used for initiatising a new Git repository. You can't run other commands before running this command. The software will start accepting other commands only after 'git init' has been run in a directory or repository
  2. git config: This command is fairly self explanatory. It stands for 'configure' and is used for setting up Git for the first time
  3. git help: Again a pretty self explanatory command. Input this one and you get the 21 most common commands for Git. If you need more specific help, then type in things like 'git help init', which shows you how to configure these specific commands
  4. git status: This command helps you find out what files are present inside a repository and what changes need to be made. It also shows you what branches of the repository are currently being worked on
  5. git add: Contrary to what you may think, this command doesn't add any files to your repository. Rather, it adds files to the software's attention and adds them to its snapshots of repository
  6. git commit: This is the most important command on Git. This is the command that adds the snapshots to the repository. The syntax for this command is 'git commit -m "Message". The -m parameter indicates that the message has to be put in there
  7. git branch: This is the command that allows users to bring new branches for making changes of their own. You have to add the title after the command, which will specify the name of the new branch. So, for a branch named 'first', you will say 'git branch first'
  8. git checkout: Literally allows you to "check out" a repository that you are not currently inside. This is a navigational command that lets you move to the repository you want to check. You can use this command as git checkout master to look at the master branch, or git checkout cats to look at another branch
  9. git merge: Remember how you could merge all the branches on Git? Well, this is the command that lets you do it. This command will merge all the branches to the master branch, which can be viewed by all the users. So, all the changes that users have made will come together
  10. git push: You work from your local computer and that is where you make your commits. But if you want these to be visible on the web on Github, then you use the 'git push' command for that
  11. git pull: This is the opposite of the above mentioned command. If you want only the newest and updated version to be available on the web, then you use this command to 'pull' the changes from the Github web version


Popular posts from this blog