Git notes

From raju

Tips

Configure http proxy

 git config --global http.proxy http://login:password@your.proxy.server:port

rebasing using git gui

Q. How to do git pull --rebase using git gui?

A. The trick is to add a custom command in git gui:

 Tools -> Add
 Name: Pull with Rebase
 Command: git pull --rebase origin
 Add globally -> check
 Add

The new command will appear under Tools menu.

Generate diff with no context

git diff -U0

In general, to generate a diff with <n> lines of context, use

git diff -U<n>

or

git diff --unified=<n>

The default is 3 lines of context.

show modified files in the current directory only

    git status .
    

or more generally

    git status /path/to/dir
    

works from git 1.7 onwards. Does not work with git 1.6.

Useful links

Migrate from sourceforge to github

The instructions to move a git repository from sourceforge to github are clearly laid out in https://help.github.com/articles/importing-a-git-repository-using-the-command-line/ .

In particular, to migrate the sampleusage project from sourceforge to github, I did

Login into github website
create a new repository called sampleusage: https://github.com/KamarajuKusumanchi/sampleusage
git clone --bare ssh://kamaraju@git.code.sf.net/p/sampleusage/git sampleusage-git
cd sampleusage-git
git push --mirror https://github.com/KamarajuKusumanchi/sampleusage.git
cd ..
rm -rf sampleusage-git

To get a local copy

git clone git@github.com:KamarajuKusumanchi/sampleusage.git
cd sampleusage
git config user.name "KamarajuKusumanchi"
git config user.email "kamaraju@gmail.com"

Sample work flow once it is all done

git add dummy_file
git commit -m "dummy commit message"
git push -u origin master

After making sure that everything on github is working properly, I submitted a ticket to delete the original sourceforge project.

git and vimdiff

viewing diffs

gitlab

external links