git常见使用命令

这里列举一下git常见使用命令:
1、从远程库下载:
git clone xxx.git
2、查看当前分支状态:
git status
3、查看当前有哪些分支:
git branch -a
4、在工作区的第一次修改被放入暂存区,准备提交
git add xxx xxx
5、暂存区的修改提交:
git commit
6、推送到远程仓库:
git push [remote_branch] [local_branch]
7、取回远程主机某个分支的更新,再与本地的指定分支合并:
git pull <远程主机名> <远程分支名>:<本地分支名>
8、从当前分支切换到‘dev’分支:
git checkout dev
9、建立并切换新分支:
git checkout -b dev
拉取远程分支到本地分支(本地不存在此分支):
git checkout -b 本地分支名 origin/远程分支名
10、查看当前详细分支信息(可看到当前分支与对应的远程追踪分支):
git branch -vv
11、查看当前远程仓库信息
git remote -vv
12、合并某分支到当前分支:git merge xx_branch
13、删除分支:git branch -d xx_branch
14、删除修改:git checkout – xxx_file xxxx_file
15、查看提交记录:git log
16、修改远程仓库地址
git remote set-url origin [url]
17、删除远程分支
git branch -r
git branch -r -d origin/branch-name
git push origin :branch-name
未完待续。。。

猜你喜欢

转载自blog.csdn.net/yunlilang/article/details/80181786