开发新功能并合并到develop整体流程的git指令操作

329 阅读1分钟

1、切换到develop分支

git checkout develop

2、拉取最新的代码

git pull

3、创建新分支feature-xx(改动全在本地,无需将新分支提交至远程)

git checkout -b feature-xx

4、改动完后,添加所有改动至 Staged Changes

git add -A

5、提交所有改动

git commit -m "done feature-xx"

6、切换到develop分支

git checkout develop

7、拉取最新的代码

git pull

8、切换到feature-xx分支

git checkout feature-xx

9、以develop为基变基

git rebase develop

eg:当变基出现冲突时,使用下面10、11、12

10、解决完冲突后,继续rebase

git rebase —continue

11、添加所有改动至 Staged Changes

git add -A

12、提交所有改动

git commit -m "fix conflict"

13、切换到 develop分支

git checkout develop

14、合并feature-xx分支

git merge feature-xx

15、推送

git push

16、删除分支

git branch -d feature-xx

eg:

error: The branch 'feature-xx' is not fully merged.
If you are sure you want to delete it, run 'git branch -D feature-xx'.

执行删除时,如果feature-xx没有完全合并,无法删除,想强制删除执行下面语句

git branch -D feature-xx