TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Only You Can Prevent git Merge Commits

26 点作者 crnixon超过 15 年前

4 条评论

jrockway超过 15 年前
Git tries pretty hard to avoid this now; it won't treat fast-forwards as merge commits, it will just fast-forward you. Apparently this was not always the case.<p>Anyway, "git pull --rebase" is your friend. (And so is "git push --force". git pull will DTRT on the other end, so this shouldn't mess anyone else up.)
评论 #1123249 未加载
评论 #1122207 未加载
评论 #1121890 未加载
r00k超过 15 年前
I've read a number of times that you should never rebase commits that other people may have fetched already. Is this a possible danger here, or will git only rebase your strictly-local commits?
评论 #1121750 未加载
schacon超过 15 年前
it's funny how some people hate merges and want to do everything with rebasing and fast-forwarding (like this) and others hate ff-ing and think everything should be done with merges to maintain branch history (<a href="http://nvie.com/archives/323" rel="nofollow">http://nvie.com/archives/323</a> thinks the '--no-ff' option should be the default).<p>personally, i use a combination - i tend to rebase when it's only a couple of commits and i merge when there are dozens of commits off, whichever is easier/cleaner. if there are likely going to be conflicts to resolve, rebase is often a bit more difficult, and people tend to have a harder time understanding rebase conceptually so i tend not to encourage it's use to beginners. however, it's interesting to see how each person subtly differently sees how the world of VCS should be, and how Git makes it relatively easy to have such different workflows.
jperras超过 15 年前
I've been using git-up (<a href="http://github.com/aanand/git-up" rel="nofollow">http://github.com/aanand/git-up</a>) for a while now - it takes care of rebasing _all_ of your tracking branches, as well as stashing &#38; unstashhing any local, uncommitted changes you may have lying around.