git 常用命令

1. ret origin/HEAD 重新设置默认分支

git remote set-head origin targetBranch

2. 删除本地分支

git branch -d branchName

3. 删除远程分支

git push origin :branchName

4. 新建分支

git branch -b branchName

5. 重命名本地分支

git branch -m oldName NewName

6. 不想继续追踪某个文件

git update-index --assume-unchanged your_file_path

7. 想再次追踪某个文件

git update-index --assume-unchanged your_file_path

8. 删除对某个文件夹的track

git rm -r --cached "bin/"
git commit -m "remove bin folder all file out of controller"

9. 从远程分支新建分支

git fetch origin 远程分支名x:本地分支名x

原文地址:https://www.cnblogs.com/graph/p/5166659.html