git 合并提交

1、检查分支的提交记录,找出基准点;

2、将基准点以后的提交revert

3、重新提交,相当于合并commit。

git reset --hard git reset --soft区别

1、二者区别:

git reset –-soft:回退到某个版本,只回退了commit的信息,不会恢复到index file一级。如果还要提交,直接commit即可;

git reset -–hard:彻底回退到某个版本,本地的源码也会变为上一个版本的内容,撤销的commit中所包含的更改被冲掉;

————————————————

版权声明:本文为CSDN博主「木林森淼」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。

原文链接:https://blog.csdn.net/yangfengjueqi/java/article/details/61668381

git reset --hard f34701c1 

你没合并之前,可以把之前所有提交合并 , 用  git reset HEAD~5, 表示之前5次提交都撤销,然后可以重新commit了;注意在checkout新分支操作;

commit 4e055349d8f408c4c7dec61f7ad1d5f44a14ec55

Date:   Thu Jun 4 15:07:22 2020 +0800

commit f05d8a6d596da6f709b05acd39cfdabf4cb30767

Date:   Fri Jun 12 11:04:53 2020 +0800

git 查看单个分支提交历史

如果dev-webpack从dev切出来的

可以用

git log dev..dev-webpack

查看单独的dev-webpack提交历史

git reset --soft 42a5195fb94bd80b020ae0c4bac292a414720014

git reset --soft f05d8a6d596da6f709b05acd39cfdabf4cb30767

On branch development

Your branch is up to date with 'origin/development'.

Changes not staged for commit:

modified:   Pod/Classes/Sources/hhhhh/sssss.m

no changes added to commit

➜  google git:(development)  

➜  google git:(development)  

➜  google git:(development) git add . -u

➜  google git:(development) git status

On branch development

Your branch is up to date with 'origin/development'.

Changes to be committed:

  (use "git restore --staged <file>..." to unstage)

modified:   Pod/Classes/Sources/dddd/dddde.m

➜  google git:(development) git commit -m'1552135 代码commit规范检查 obsoletes:1905e94'

[development 5f956174] 1552135 代码commit规范检查 obsoletes:1905e94

 1 file changed, 1 insertion(+), 1 deletion(-)

➜  google git:(development) git checkout -b feature/xxxx

Switched to a new branch 'feature/xxxx'

➜  google git:(feature/xxxx) git push origin feature/xxxx:feature/xxxx

原文地址:https://www.cnblogs.com/feng9exe/p/13288987.html