#FirstSteps: Most used Git Commands and concepts
Git offers a very wide variety of commands but here are the ones which are used on almost daily basis. This article is draft stage and targets beginners and is in process of expansion. If you are looking for advanced concepts then you are free to skip this article. Please leave your feedback if any.
1. Git init
It initializes a git repo on your local.
2. Git Add .
Adds files in your git repo to staging i.e. ready for check-in/commit to branch.
3. Git Commit -m “my Git commit comment”
Commits your code to the branch.
4. Git Push
Pushes your code to remote repo for online code collaboration.
Please note that this following commands will be used in combination very frequently to update your code to the local and remote repos:
git add .
git commit -m “updating code to the repo”
git push
5. Git Remote
Shows your remote repo locations configuration.
6. Git branch “branchname”
Creates a git branch.
7. Git Checkout “branchname”
Checks out your branch for changes and lets you start working with it, you can also use this command to create a new branch .
If you come from TFS background you should note that you checkout branches while working wiht Git repos where as in TFS you checkout files.
8. Git Merge
Merges specified branch to a target branch.