User Tools

Site Tools


git:git_cheatsheet

This is an old revision of the document!


GIT CheatSheet

List current status (including changes) in repo

git status

List files in repo

git ls-files

List deleted files in repo

git ls-files -d

Undelete file

git checkout filename

Undelete all deleted files

git ls-files -d | xargs git checkout --

Mark conflict as resolved

filename will have merge conflicts marked in the same way used in CVS.

git add filename

marks the conflict as resolved.

Turn off pager

git --no-pager [command]

Run

alias git='git --no-pager'

to disable it on all commands in the current shell. Alternatively set core.pager = in .gitconfig (it is set to the empty string.) to disable it entirely for that user.

Tags

Create

git tag -a v1.4 -m 'version 1.4'

List

All:

git tag

Or filtered:

git tag -l v1.*

Show

git show v1.4

Push

By default, the ‘git push’ command will not transfer tags to remote servers. To do so, you have to explicitly add a –-tags to the ‘git push’ command.

Branches

List branches

git branch

Switch to branch

git checkout [branchname]

CVS 2 GIT

git cvsimport -k -i -d server:/path/to/CVSHOME -C git_reponame cvs_reponame

The resulting git_reponame directory now contains the .git folder which can be moved to a server location for shared access. Run git update-server-info in the new server folder in order to make it shareable.

Branching/Merging

git/git_cheatsheet.1343818167.txt.gz · Last modified: 2012/08/01 12:49 by deva