Git internal

多帐号管理

Rename a Branch

# switch to branch you want to rename
git checkout branch-you-want-to-rename
# rename to new name
git branch -m new-branch-name
 
# or use a single command without switching
git branch -m old-branch-name new-branch-name

Merge a Specific Commit

git cherry-pick <commit-hash>

Git Submodule

使用git submodule替换本地fork

git submodule add /path/to/repos/libA.git lib/lib_a
git submodule status
git submodule init
git submodule update

refs:

Git Alias

Commit

gcmsg=‘git commit -m’ gcam=‘git commit -a -m’ gc!=‘git commit -v —amend’ gcan!=‘gcan!’=‘git commit -v -a —no-edit —amend’

checkout

gco=‘git checkout’ gcm=‘git checkout $(git_main_branch)‘

pull

gupa=‘git pull —rebase —autostash’ gup=‘git pull —rebase

push

gp=‘git push’

rebase

grb=‘git rebase’ grbc=‘git rebase —continue’

stash

gsta=‘git stash push’ gstc=‘git stash clear’ gstp=‘git stash pop’ gstu=‘git stash —include-untracked’

status

gss=‘git status -s’ gst=‘git status’