git相关的操作

给大家分享下git的使用心得,有不足的请大家补充:

克隆:git clone https://XXXXX

克隆指定分支:git clone -b https://XXXX

添加所有:git add .(注意add后面有个点

添加指定:git add XXX

上传本地:git commit -m “XXX”

推送服务器:git push -u origin "branch-name"

拉取更新:Git pull origin “branch-name”

本地与远程分支同步:git pull

合并:git merge “branch-name”(想把A分支合并到B分支,需要切换到B分支,然后执行git merge A)

切换分支:git checkout “branch-name”

创建分支:Git branch “branch-name”

创建并切换分支:git checkout -b “branch-name”

拉取查看更改:git diff HEAD^

查看本地修改:git diff

查看分支:Git branch

查看远程分支:git branch -r

查看分支状态:git status

删除分支:git branch -d “branch-name”

删除远程分支:git branch -r -d “branch-name”

取消修改:git checkout .(注意checkout后面有个点

猜你喜欢

转载自www.cnblogs.com/xupeidong/p/10730259.html