git rebase

2017-05-25 22:06:11 +08:00
 thomaswang
git checkout master
git rebase myBranch
git push

如果同事这样做,别人一看 master,就以为我违规操作,直接把代码直接提交到 master,怎么把问题说清楚呢?,
4389 次点击
所在节点    git
25 条回复
thomaswang
2017-05-26 12:31:06 +08:00
@yanhejihe 对的,是不合理,如果在 aBranch 上,git rebase bBranch , 并且 bBranch 上的提交都先于 aBranch 上的提交,有什么方法可以判断一个 commit,在 rebase 之前,是在 aBranch 还是在 bBranch 上提交的吗
thomaswang
2017-05-26 12:32:19 +08:00
@msg7086 我 commit 的时候,author 和 commiter 的信息都是我,别人 rebase 之后,这两个信息没有变动啊
wpzero
2017-05-26 18:09:39 +08:00
这样,应该不好吧,这个意思是 master 在你的分支之上了,算是 merge ?而且 commit 进去的顺序也不对吧,比如 master 现在指向一个 A_commit 你的分支指向 B_commit 那么你这样操作完之后 A_commit 在你的 B_commit 之上了是不是。感觉应该 git pull --rebase; git rebase master myBranch 然后再提交一个 pr, ok 了, 那么 git checkout master; git pull --rebase 然后 git merge myBranch; 然后 git push origin -u HEAD:refs/heads/master;
Reficul
2017-05-26 19:39:31 +08:00
Github 的话你的 commit 加上 GPG 签名,开 master 分支保护。
msg7086
2017-05-27 01:25:44 +08:00
@thomaswang 我这里没问题。

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/363843

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX