Skip to content

Instantly share code, notes, and snippets.

@shiv4289
Last active May 2, 2019 09:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shiv4289/f8fc7abf2daf02a72733cd0603b13635 to your computer and use it in GitHub Desktop.
Save shiv4289/f8fc7abf2daf02a72733cd0603b13635 to your computer and use it in GitHub Desktop.

Change remote URL

git remote set-url origin new.git.url/here Ref

Make local same as remote

git fetch origin git reset --hard origin/master Ref

Git generate patch for last commit

git format-patch -1 Ref

Git apply patch

  1. First the stats: git apply --stat a_file.patch
  2. Then a dry run to detect errors: git apply --check a_file.patch
  3. Finally, you can use git am to apply your patch: git am < a_file.patch Ref

Search commit logs

git log --grep="pattern" Ref

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment