1:查看版本关联关系

git branch -vv

2:查看所有分支

git branch -a

3:指定从哪个远程仓库拉取代码

git pull origin B#fenglebing-otn

例如:
帮冯乐兵删除文件[手动删掉之后]
[email protected] MINGW64 /e/tiap-code/tiap-webapp (B#yanglin)

$ git status
On branch B#yanglin
Changes not staged for commit:
(use “git add/rm …” to update what will be committed)
(use “git checkout – …” to discard changes in working directory)

modified: app.js
modified: config/default.json
modified: extroot/app/Application.js
deleted: extroot/app/view/tiap/otn/common/resModelForm.js
deleted: extroot/app/view/tiap/otn/common/resModelgrid.js

no changes added to commit (use “git add” and/or “git commit -a”)

[email protected] MINGW64 /e/tiap-code/tiap-webapp (B#yanglin)
$ git add extroot/app/view/tiap/otn/common/resModelForm.js

[email protected] MINGW64 /e/tiap-code/tiap-webapp (B#yanglin)
$ git add extroot/app/view/tiap/otn/common/resModelgrid.js

[email protected] MINGW64 /e/tiap-code/tiap-webapp (B#yanglin)
$ git commit extroot/app/view/tiap/otn/common/resModelForm.js -m “flb delete file”

git commit extroot/app/view/tiap/otn/common/resModelgrid.js -m “flb delete file”

4:从我的分支推送代码到老冯的分支

git push origin B#yanglin:B#fenglebing-otn

5:关联远程分支

git push -u origin B#yanglin

开发中创建了自己的特性开发分支之后,切换到自己特性分支之后,使用如上命令之后自动与gitlab上的远程分支关联,无需手动在gitlab上创建。

6:刷新远程操作

git remote update origin -p

7. git中关系图

git开发中注意的一些事项

  • Workspace:工作区
  • Index / Stage:暂存区
  • Repository:仓库区(或本地仓库)
  • Remote:远程仓库

相关文章: