index
- List Files' Change of Specific Directroy
- Rename Exist Tag
- Reset Added File
- Difference Between Two Specific Version for Specific file(s)/folder(s)
- Generate Patch and Apply patch
- Rename A Local Branch
- Modify Last Git Commit
- Push Specific Commit/Branch/Tag to Github
- Check Those Changes Which Have Been Added
- Git Auto-Completion in Bash
- Fetch Specific Branch Only
- Show Short Log
List Files' Change of Specific Directroy
git ls-files -t -o -m DIRECTORY_NAME
NOTE! This command cannot trace the changed files which has been added by git add
Rename Exist Tag
The original question was how to rename a tag, which is easy.
First create NEW as an alias of OLD:
git tag NEW OLD
Then delete OLD:
git tag -d OLD.
Reset Added File
git reset FILE
Difference Between Two Specific Version for Specific file(s)/folder(s)
git diff VER1 VER2 FILE/DIR
OR to show what has been changed:
git diff VER --stat FILE/DIR
Generate Patch and Apply patch
cd into specific directory:
git diff --no-prefix BRANCH/TAG FILE/DIR > PATCH_NAME
patch -p0 < PATCH_NAME
Rename A Local Branch
git branch -m OLD_BRANCH NEW_BRANCH
Modify Last Git Commit
git commit --amend
Push Specific Commit/Branch/Tag to Github
git push origin HEAD:refs/heads/REMOTE_BRANCH_NAME
Check Those Changes Which Have Been Added
git diff --cached
Git Auto-Completion in Bash
curl https://raw.github.com/git/git/master/contrib/completion/git-completion.bash -o ~/.git-completion.bash
Then add some lines to ~/.bashrc
if [ -f ~/.git-completion.bash ]; then . ~/.git-completion.bash fi
Fetch Specific Branch Only
git fetch shgit yrliao/berlin/1080/ct_sm_cec
Show Short Log
git log --pretty=short