1.拉取远程仓库:
git clone https://xxx/xxx/xxx.git
2.查看分支结构:
git branch -a
3.确认分支结构
git checkout 分支名
4.把代码添加到暂存区
git add .
5.提交
从暂存区提交到提交区
git commit -m "feat(model): [XXX] Commit message"
从工作目录提交到提交区
git commit -a -m "feat(model): [XXX] Commit message"
如果提交修改的文件比较多:
"feat(cmdb): [cr_id_skip] Commit message no_3rd_skip"
6.代码冲突如何解决?
方法一:stash命令可以将本地还没有提交的代码放入缓存区,使用stash命令以后拉取远程代码,然后stash pop或者stash apply,将本地的修改应用到新的代码上面。
git stash
git pull
git stash pop
git stash apply
方法二:拉取新的代码以后,对发生的冲突的代码进行处理,合并change或者丢弃change
7.提交给CR:
arc diff --create
或者 arc diff --update Dxxxx
8.提交到代码仓库:
arc land --revision Dxxxx
记录项目中git的一些用法
最新推荐文章于 2025-03-27 16:30:45 发布