Skip to content

Latest commit

 

History

History
71 lines (55 loc) · 1.16 KB

2018-11-29-git-cheat-sheet.md

File metadata and controls

71 lines (55 loc) · 1.16 KB

Git Cheat Sheet

git create branch from un-staged changes

git checkout -b new_branch_name

checkout pull request locally

git fetch origin pull/ID/head:BRANCHNAME

git pull from remote to override local changes

git fetch origin
git reset --hard origin/master

Git pull remote branch locally

git fetch origin
git checkout --track origin/<remote_branch_name>

git push local branch to remote

git checkout -b <branch>
git push -u origin <branch>

Git merge master to update branch

git checkout <branch>
git merge master 

or merging vs rebasing

to view previous commits

git log 

to add to previous commit

If have not pushed

git commit --amend

if you have pushed

if you have pushed already same as above but you can force a push to amend remote as well

git push -f