git多人协作

来源:互联网 发布:abaqus软件 编辑:程序博客网 时间:2024/05/22 07:54
git clone http://gitlab.buptnsrc.com/sunsanqi/pc-malware-kaggle.git将远程仓库克隆到本地

正克隆到 ‘pc-malware-kaggle’… Username for ‘http://gitlab.buptnsrc.com‘:
sunsanqi Password for ‘http://sunsanqi@gitlab.buptnsrc.com‘: remote:
Counting objects: 22, done. remote: Compressing objects: 100% (22/22),
done. remote: Total 22 (delta 6), reused 0 (delta 0) 展开对象中: 100%
(22/22), 完成. 检查连接… 完成。

cd pc-malware-kaggle/进入克隆到本地的远程仓库文件夹
git remote -v显示了可以抓取和推送的origin的地址。如果没有推送权限,就看不到push的地址

origin http://gitlab.buptnsrc.com/sunsanqi/pc-malware-kaggle.git (fetch)
origin http://gitlab.buptnsrc.com/sunsanqi/pc-malware-kaggle.git (push)

git checkout -b sunsanqi

创建并切换到一个新分支 ‘

sunsanqi'git branch

dev
master
* sunsanqi
git branch命令会列出所有分支,当前分支前面会标一个*号

vim git_test.txt编辑一个测试文件vim git_test.txt,并保存
git add git_test.txt将这个文件添加到当前分支
git commit -m "first commit"

[sunsanqi 7d9ad91] first commit
1 file changed, 1 insertion(+)
create mode 100644 git_test.txt

git push -u origin sunsanqi将sunsanqi分支推送到远程库origin中

Username for ‘http://gitlab.buptnsrc.com‘: sunsanqi Password for
‘http://sunsanqi@gitlab.buptnsrc.com‘: 对象计数中: 3, 完成. Delta
compression using up to 8 threads. 压缩对象中: 100% (3/3), 完成. 写入对象中: 100%
(3/3), 292 bytes | 0 bytes/s, 完成. Total 3 (delta 1), reused 0 (delta
0) To http://gitlab.buptnsrc.com/sunsanqi/pc-malware-kaggle.git *
[new branch] sunsanqi -> sunsanqi 分支 sunsanqi 设置为跟踪来自 origin
的远程分支 sunsanqi。

  • 回到网页gitlab中,点击New Merge Request,这一步作用是向gitlab管理员提交合并分支请求,若管理员同意,则合并分支;至此,项目提交成功。
  • 参考链接[https://www.liaoxuefeng.com/wiki/0013739516305929606dd18361248578c67b8067c8c017b000/0013760174128707b935b0be6fc4fc6ace66c4f15618f8d000]