Frequently used git commands
git init
git diff
git add .
git commit -m "Made some changes"
git checkout -b issue87
git branch
git checkout issue13
git remote remove origin
git remote add origin https:#github.com/dancancro/ng2-redux-form
git stash
git stash apply
git push origin HEAD
git diff branch1..branch2
git branch -d branchname
git push origin --delete branchname
git checkout dest_branch
git merge source_branch
git checkout -- .
git clean -xfd
git branch mynewbranch git git reset --soft HEAD~3 # only if you want to undo last 3 commits git checkout mynewbranch
git checkout master git merge --squash bugfix git commit
Do this so you can see the differences between your files and a previous commit. Repeat the command until you reach the point against which you want to compare your current files
git reset --soft HEAD~
- Rename your local branch. If you are on the branch you want to rename:
git branch -m new-name
If you are on a different branch:
git branch -m old-name new-name
- Delete the old-name remote branch and push the new-name local branch.
git push origin :old-name new-name
- Reset the upstream branch for the new-name local branch. Switch to the branch and then:
git push origin -u new-name
Writing a good commit message Set of useful commands like this but much better