git 常用的分支操作
时间:2022-01-12 11:26:41 +0800 CST 浏览:76

pull 远程所有分支代码到本地

git branch -r | grep -v '\->' | while read remote; do git branch --track "${remote#origin/}" "$remote"; done
git fetch --all
git pull --all

push 本地所有分支到远程

git push --all origin -f

删除分支

# 1、删除本地分支
git branch -D <branch>
# 2、删除远程分支
git push origin --delete <branch>

创建分支

git branch -m master

清空所有commit记录

# 1.Checkout
git checkout --orphan latest_branch

# 2. Add all the files
git add -A

# 3. Commit the changes
git commit -am "commit message"

# 4. Delete the branch
git branch -D master

# 5.Rename the current branch to master
git branch -m master

# 6.Finally, force update your repository
git push -f origin master


如果这篇文章对你有所帮助,可以通过下边的“打赏”功能进行小额的打赏。

本网站部分内容来源于互联网,如有侵犯版权请来信告知,我们将立即处理。


来说两句吧