git 常用命令

git添加本地分支与远程分支对应关系:

git branch --set-upstream master origin/master

 

git pull远程分支:

git checkout -b < new_branch > origin/< new_branch >

 

git删除本地分支与远程分支:

 delete a local branch

git branch -d the_local_branch

remove a remote branch (if you know what you are doing!)

git push origin :the_remote_branch



git显示本地与远程所有分支对应关系:

For all branches:

git branch -avv

For local branches only:

git branch -lvv



创建一个空的分支:
git checkout --orphan <branchname>
删除所有文件
git rm -rf .
 
 
git删除所有untrack文件:

git clean -f
But beware... there's no going back. Use -n or --dry-run to preview the damage you'll do.

If you want to also remove directories, run git clean -f -d

If you just want to remove ignored files, run git clean -f -X

If you want to remove ignored as well as non-ignored files, run git clean -f -x

 

git rename本地分支:

git branch -m <oldname> <newname>

 

 



 

 

你可能感兴趣的:(常用命令)