ragnarokkrr
4/27/2016 - 7:43 PM

Git

Git

Commands

clean

Remove files that aren't part of the repo:

git clean -f

submodule

Checkout a repo's submodules:

git submodule init
git submodule update

Coobook

Show file contents from a certain revision

git show {commit}:{path}

Update file contents from a certain revision

git checkout {commit}:{path}

Is one commit an ancestor of another?

git merge-base --is-ancestor {old-commit} {new-commit}

Find commits matching text

git log -G{regexp}

List files in another branch

git ls-tree -r --name-only {branch}

Copy file from another branch

git checkout {branch} -- {files}

Split a big commit

Start a rebase from the commit

git rebase -i {commit}~1

Mark commit(s) to be split with "edit" and save.

git reset HEAD~

Create smaller commits.

git rebase --continue