Monday, June 17, 2019

Git commands cheat sheet (in progress)


Committed but not pushed to remote. Want to get rid of latest commit
git reset --hard HEAD~1
Get a branch from a forked repo to your own repo (or to your own forked repo)
git reset HEAD~1 

Get a branch from a forked repo to your own repo (or to your own forked repo)


git fetch git@github.com:theirusername/reponame.git theirbranch:ournameforbranch
Associate your local copy to the upstream branch
git remote add repo_name https://github.com/theirusername/their_repo.git
Fetch their new commits and merge to your branch
git fetch protected_repo
git merge protected_repo/foo