Last updated on March 20, 2020
I thought to write this blog post for absolute beginner who wants to learn and use it for Most Essential Git Commands.
I list down the GIT commands here,
Most Essential GIT Commands
-
git init– To initialize git repo in your local system
git add && git commit -m "<message>"– To add and commit your changes to locally.
git pull && git push– To push your changes to the remote repository but before doing that we must ensure any changes are available from remote repository.
git merge <from_branch_name>– To merge one branch to the current branch, here <from_branch_name> specifies the desired branch to be merged.
-
git reset HEAD~1– To revert our recent commit from local system and just by adding –hard or –soft determines whether to keep the changed files in local or not. In short,git reset HEAD~1 --soft
git stash save– To save your changes locally without committing! Most absolute beginner didn’t aware of this simple command. I personally prefer to use this command most of the time.
-
git stash apply @{stash_id}– To retrieve the top most saved changes and apply it in local current repository.
git stash list– To list down all the saved stash entries from your local system.
I wanted to keep this information as much as straight-forward. Thus, software developer who is in beginner stage also will get beneficial out of this.
I will write about advanced GIT Commands in my next blog post. Stay tuned till then.