Git Bash 中常用的命令

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/guyan1101/article/details/86496879

git status    查看本地修改与服务器的差异。

git add .  将这些差异文件添加,这样就可以提交了。

git commit –m   “这里是注释”提交更改到服务器。

git checkout master  更改到master库。

git pull  将服务器最新的更改获取到本地。

git merge local master  将本地的local合并到远程的master上。

git push origin master  正式提交到远程的master服务器上。

git  clone  git://github.com/someone/some_project.git   some_project    将'git://github.com/someone/some_project.git'这个URL地址的远程版本库,完全克隆到本地some_project目录下

git remote -v    查看远程仓库

git remote add   添加远程仓库

git remote rm [name]   删除远程仓库

git remote set-url --push [name] [newUrl]   修改远程仓库

git pull [remoteName] [localBranchName]    拉取远程仓库

git push [remoteName] [localBranchName]    推送远程仓库

git branch    查看本地分支

git branch -r    查看远程分支

git branch [name]     创建本地分支----注意新分支创建后不会自动切换为当前分支

git submodule add [url] [path]    添加子模块

git submodule init  初始化子模块 ----只在首次检出仓库时运行一次就行

git submodule update 更新子模块----每次更新或切换分支后都需要运行一下

猜你喜欢

转载自blog.csdn.net/guyan1101/article/details/86496879