Git common

Display Japanese (file name etc) in Git Bash

$ git config --global core.quotepath false

Disable convert CRLF

If use same git working directory in Windows and Linux dual boot, auto converting CRLF should be disabled.

$ git config --global core.autocrlf false


* Git export only export committed file (different to subversion).


Add/Remove msysGit shell extension (context menu on Windows)

Run with msysGit 1.9.2

REM Goto folder
cd /d "C:\Program Files (x86)\Git\git-cheetah"

REM Install shell extension
regsvr32 git_shell_ext64.dll

REM Remove shell extension
regsvr32 /u git_shell_ext64.dll

Tag and push to server

# To create a lightweight tag (another kind is annotated tag).
git tag v0.2.4
# Push to remote server
git push origin v0.2.4

Rename a tag

# Rename v1.0.6 to v0.1.6
git tag v0.1.6 v1.0.6
git tag -d v1.0.6
git push origin :refs/tags/v1.0.6
git push --tags

Create a branch and switch to it

git branch <branch name>
git checkout <branch name>

A shorthand

git checkout -b <branch name>

Push a branch

git push origin <branch name>

Create .git dir outside current directory

git init --separate-git-dir /d/data/GitDirs/AProject.git .

Add remote URL to local git

git remote add origin <url>
git config push.default current

The second command make “git push” to equivalent to “git push origin master”


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: