Skip to content

Instantly share code, notes, and snippets.

@towfiqpiash
Last active July 23, 2017 04:51
Show Gist options
  • Save towfiqpiash/0288e07cd911a5053910f7add5744a4f to your computer and use it in GitHub Desktop.
Save towfiqpiash/0288e07cd911a5053910f7add5744a4f to your computer and use it in GitHub Desktop.
All about git

Get latest changes from master to branch

git checkout piash      # gets you "on branch piash"
git fetch origin        # gets you up to date with origin
git merge origin/master

Merge detached head to origin/master

git checkout master && git merge [ref of HEAD]    # ref of HEAD = latest hash of detached head

Restore state to a given commit and erase all newer commits from the record permanently

$ git reset --hard 766f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment