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

Errorfatal: unable to write to remote: Broken pipe error: could not fetch origin

Solution: TBD

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值