Skip to content

Instantly share code, notes, and snippets.

@stevemohapibanks
Created November 20, 2012 17:18
Show Gist options
  • Save stevemohapibanks/4119358 to your computer and use it in GitHub Desktop.
Save stevemohapibanks/4119358 to your computer and use it in GitHub Desktop.
Git commands

Managing branches

Checkout a remote branch to a new local branch

git pull
git checkout -b local-branch origin/remote-branch

Remove a remote branch (e.g. from Github once merged)

git push origin --delete <branchName>

Managing submodules

Move a submodule

mv dir/submodule newdir/submodule
Edit newdir/submodules/.git file to point to parent .git/modules/submodule dir
Edit ./git/modules/submodule/config and update worktree path
Edit .gitsubmodules in parent to update submodule path
git add -u
git add newdir/submodule
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment