# Diff a file of two branches and apply to the cuurent branch
git diff **HEAD** *other_branch* -- *file_name* | git apply
# Git log for the specific commit
git show *commit*
# Add all modification/deleted changes to staged
git add -u
# Commit all modification/deleted changes without staging
git commit -a
# Show only modifications
git status -uno
# Rename a branch
git branch -m new-branch
git branch -m old-branch new-branch
# Squash commits
git rebase -i {the previous one commit}
git push origin +originbrach
```text
Note that --force applies to all the refs that are pushed, hence using it with push.default
set to matching or with multiple push destinations configured with remote.*.push may
overwrite refs other than the current branch (including local refs that are strictly behind
their remote counterpart). To force a push to only one branch, use a + in front of the
refspec to push (e.g git push origin +master to force a push to the master branch).
```
# Restore a file to some commit
git checkout $SHA1 `--` $FILE
> if you want revert this commit
> git checkout $SHA1~ `--` $FILE
# Force pull to overwrite local
git fetch --all
git reset --hard origin/$BRANCH
# Avoid the merge-commit when remote changed
get fetch
get rebase origin/$BRANCH