Skip to content

Instantly share code, notes, and snippets.

@ApprenticeGC
Created September 5, 2012 23:43
Show Gist options
  • Save ApprenticeGC/3647837 to your computer and use it in GitHub Desktop.
Save ApprenticeGC/3647837 to your computer and use it in GitHub Desktop.
Grasp Git Command
git merge [-n] [--stat] [--no-commit] [--squash]
[-s <strategy>] [-X <strategy-option>]
[--[no-]rerere-autoupdate] [-m <msg>] [<commit>…]
--no-commit
Perform the merge and commit the result. This option can be used to override --no-commit.
With --no-commit perform the merge but pretend the merge failed and do not autocommit, to give the user a chance to inspect and further tweak the merge result before committing.
ours
This resolves any number of heads, but the resulting tree of the merge is always that of the current branch head, effectively ignoring all changes from all other branches. It is meant to be used to supersede old development history of side branches. Note that this is different from the -Xours option to the recursive merge strategy.
git pull [options] [<repository> [<refspec>…]]
-s <strategy>
--strategy=<strategy>
Use the given merge strategy; can be supplied more than once to specify them in the order they should be tried. If there is no -s option, a built-in list of strategies is used instead (git merge-recursive when merging a single head, git merge-octopus otherwise).
subtree
This is a modified recursive strategy. When merging trees A and B, if B corresponds to a subtree of A, B is first adjusted to match the tree structure of A, instead of reading the trees at the same level. This adjustment is also done to the common ancestor tree.
git read-tree [[-m [--trivial] [--aggressive] | --reset | --prefix=<prefix>]
[-u [--exclude-per-directory=<gitignore>] | -i]]
[--index-output=<file>] [--no-sparse-checkout]
(--empty | <tree-ish1> [<tree-ish2> [<tree-ish3>]])
-u
After a successful merge, update the files in the work tree with the result of the merge.
--prefix=<prefix>/
Keep the current index contents, and read the contents of the named tree-ish under the directory at <prefix>. The command will refuse to overwrite entries that already existed in the original index file. Note that the <prefix>/ value must end with a slash.
git remote add [-t <branch>] [-m <master>] [-f] [--tags|--no-tags] [--mirror=<fetch|push>] <name> <url>
With -f option, git fetch <name> is run immediately after the remote information is set up.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment