Branch action:
git checkout '{existing branch name}'
git checkout -b '{new branched name based on current branch}'
Commit:
git commit -m 'message body'
Merge action:
git merge --commit
Clean up:
delete untracked files
git clean -fd
remove unstaged modification/deletion
git checkout .
delete untracked & ignored files
git clean -xfd
Others:
Delete local branches that have been removed from remote
Option1: run in powershell:
-- run in powershell
git checkout master; git remote update origin --prune; git branch -vv | Select-String -Pattern ": gone}" | % { $_.toString().Trim().Split(" ")[0]} | % {git branch -D $_}
Option2: use npm package
npm install -g git-removed-branches
git removed-branches
git removed-branches --prune
FAQ:
Error: cannot lock ref 'refs/remotes/origin/xxx': is at abc123 but expected def456
Solution:
git update-ref -d refs/remotes/origin/xxx
Error: fatal: unable to write to remote: Broken pipe
Solution:
git config --global http.postBuffer 524288000
git config http.postBuffer 524288000
Error: fatal: unable to write to remote: Broken pipe error: could not fetch origin
Solution: TBD
Error: Unlink of file '.git/objects/pack/pack-ccbd2f013de887429b2812cc15a15eb8008c7f49.idx' failed. Should I try again? (y/n)
Solution: run below script, during process you'll still meet issue and pls enter "n" then under folder "/.git/objects/pack/" files will be clear, delete these orphaned xxx.idx files
git gc --aggressive
47

被折叠的 条评论
为什么被折叠?



