Git Commands
Below are some Git Commands for daily usage:
-
git status ---This command will give you list of the files which has all changes
-
git add .(Dot) --- This command adds a change in the working directory to the staging area
-
git checkout -b "your branch name" --- This command will create branch
-
git commit -am "added comment here" --- This command will commit you changes
-
git pull origin master ---This command will pull changes from master or you can changes branch name to pull from.
-
git push origin (branch-name) --- This command will push to your current branch
-
git stash --- Stashing takes the dirty state of your working directory
-
git clone http://www.git.somaiya.edu.git --- Used to point to an existing repo and make a clone or copy of that repo at in a new directory, at another location
-
git reset [file, commit, head] - This command is used to reset the file, commits and whole head.
-
Reset Head:
The HEAD in Git is the pointer to the current branch reference, which is in turn a pointer to the last commit you made or the last commit that was checked out into your working directory. That also means it will be the parent of the next commit you do
git reset –hard
-
Reset Specific File:
git reset “path/filename.extension”
-
Reset Commit ID:
git reset c14809fa – commit id
Reference link:
https://dzone.com/articles/top-20-git-commands-with-examples
Thanks to Kiran Sir for contributions with ref link...