Linux Ask!

Linux Ask! is a Q & A web site specific for Linux related questions. Questions are collected, answered and audited by experienced Linux users.

May 162012
 

How to push to origin but a different branch using Git

Answer:

Assume you normally push your local changes to the remote's master branch, but what if you want to push the changes into another branch (e.g. testing)?

You can easily do this by using the command:

# git push origin master:testing

Apr 302012
 

How do I make git ignore mode changes

Answer:

By default, if you have changed the file permission, git will also count the changes in file mode , e.g.

# git diff TEST.txt
diff --git a/TEST.txt b/TEST.txt
old mode 100644
new mode 100755

To ignore, simply type

# git config core.filemode false

Feb 042012
 

Remove un-staged files or directories from Git repository

Answer:

To remove newly added files or directories under a Git repository (but un-staged yet), do:

# git clean -fdn

Check if the files/directories are really okay to remove. Then, execute the command again without the '-n'

# git clean -fd

Dec 282011
 

Show changed files with git log

Answer:

In svn, you can use

# svn log -v

to show a detail list of changed files in each commit.

In git, you can use to have similar effect:

# git log --stat.