==============================
Commonly used GIT commands
==============================
/* Command to clone GIT repository */
$git clone <REPO_URL>
/* Shows current working branch */
git branch
/* Shows all branches in the repo */
git branch -r
git branch -a
/* Command to set current branch */
git checkout <branch_name>
/* Command to check current status of the branch */
git status
/* Command to commit*/
git commit
git commit -a
git commit -m "Commit message"
git commit -am "Commit message"
/* To commit without extra shas */
git commit --amend --no-edit
/* Revert 1 commit from remote branch*/
git reset --soft HEAD~1
git reset --soft 8272dfaf690f6b5abb78af6fc81cf5a03f4c9d08
git reset --soft 3c1a546812530d3ad3ca8b58d69f825476ddc651
/* To move head to a particular commit */
git reset --hard SHA
git reset --hard e16f7212ab0932fd3fcc6e58250f180c1afb7eea
git reset --hard 1e722e9a726cd7e5fbca7037f8d73f06ef31e0d9
/* Discard all local changes, but save them for possible re-use later */
git stash
/* Discard local changes*/
git checkout HEAD^ file/to/overwrite
git pull
/* To push the commit changes to remote branch */
git push
git push -f
/* Command to see changes done to code in local repo <branch_name> */
git diff
/* Command to check commit history of your branch */
git log
/* Command to check commit history of a particular branch of master */
git log <master_branch_name>..<branch_name>
==============================
Create branch locally
==============================
/* Command to create local branch from master branch */
git checkout -b <local_branch_name> <master_branch_name>
/* Command to create local branch from a commit */
git branch commit-branch SHA
/* If the branch is created locally, this will create remote branch with
<local_branch_name> */
git push -u origin <local_branch_name>
git push --set-upstream origin <local_branch_name>
==============================
Delete branch
==============================
/* Command to delete a local branch */
git branch -rd <local_branch_name>
git push
==============================
Rebase
==============================
git checkout master
git pull
git pull origin --
git checkout local_branch_name
git rebase master (Only rebase)
git rebase -i master (interactive rebase)
==============================
Initial Setup
==============================
/* Commands to set the git configuration */
git config --global [Link] "FirstName LastName"
git config --global [Link] "email@[Link]"
/* Commands to check the git configuration */
git config [Link]
git config [Link]
/* Commands to store the git configuration for future use - no need to enter the
credentials every time you push */
git config --global [Link] 'cache --timeout 7200'
/*Permanently authenticating with Git repositories*/
git config [Link] store
/*Edit editor*/
git config --global [Link] "'C:/Program Files/Notepad++/notepad++.exe' -
multiInst -notabbar -nosession -noPlugin"
git config --global --unset-all [Link]
/*SWF Access Token*/
git config --global --edit
[url "[Link]
insteadOf = [Link]