Skip to content

Instantly share code, notes, and snippets.

@igregson
Last active March 21, 2020 14:46
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 igregson/2d6328d6ca3b3cde7ca9491d29ce6c0a to your computer and use it in GitHub Desktop.
Save igregson/2d6328d6ca3b3cde7ca9491d29ce6c0a to your computer and use it in GitHub Desktop.
quicker to reference a gist than search the innerwebs...

Resolving merge conflicts

git checkout --ours index.html
git checkout --theirs _layouts/default.html

Remove files from repo after Adding to gitignore

git rm -r --cached .
git add .
git commit -m "Remove all files in .gitignore"

Clone specific branch

git clone -b <branch> <remote_repo>

# Example: 
git clone -b develop git@github.com:user/myproject.git

Push new brach to remote

git push -u origin <branch>

Delete remote branch

git push origin :old_branch

Rename remote branch (after renaming locally)

git push --set-upstream origin new_branch

To clear cache for local git branch tab completion (e.g. git checkout {hitTab})

git fetch --prune --all
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment