selfjungle Just another WordPress weblog

31Oct/160

git word diff

git diff --word-diff=color

shows changes in place.

Tagged as: No Comments
10Apr/140

Export/apply git diff as patch

git diff > save.patch
patch -p1 < save.patch

Link: Stackoverflow

Tagged as: No Comments
25Oct/130

git auto-completion

wget https://raw.github.com/git/git/master/contrib/completion/git-completion.bash -O ~/.git-completion.bash
source ~/.git-completion.bash
Tagged as: , No Comments
18Oct/130

pushing to a non-bare git repo

Init a directory as a bare repo in the first place:

git init . # non-bare
git init -bare . # bare

To be able to push into a non-bare repo, just check out a branch users don't push to:

git checkout -b DUMMY_BRANCH_DONT_USE

Or turn it into a bare repo:

rm *
mv .git/* .
rm .git
sed -i 's/bare = false/bare = true/' config

Source: gitolite

Tagged as: No Comments
26Sep/130

git ignoring changes

Ignoring files in repository:

edit .gitignore
git update-index --[no-]assume-unchanged FILE # if rule was added after the tracked file

Ignoring files in all repositories on your computer:

edit ~/.gitignore_global
git config --global core.excludesfile ~/.gitignore_global

Ignoring local per-repository files:

edit .git/info/exclude

Source: github help

Tagged as: No Comments
18Jul/110

git tag

Tag commit:

git tag -m <msg> <tagname> <commit>

Push tags (not done by default):

git push --tags <remote> <branch>

Fetch tags:

git fetch --tags <remote> <branch>

or

git remote update <remote>
Tagged as: No Comments