git usage
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
原文地址:https://blog.csdn.net/chensyabc/article/details/142784712
免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!