Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
214 views
in Technique[技术] by (71.8m points)

git - How to properly rebase in SourceTree?

SourceTree 1.6.4.0 on Windows 7.

Let's say the following is my starting point:

enter image description here

 C <- master
/
- A - B <- topic

I want to rebase topic onto master.
My goal is to have:

  C - A - B
  ^       ^
master  topic

but I end up with:

enter image description here

I can then do

git push origin topic -f

and I get the intended result, but what is the proper way to do this in SourceTree?

question from:https://stackoverflow.com/questions/25747146/how-to-properly-rebase-in-sourcetree

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Update: SourceTree 1.9.1

You can enable force push in Tools/Options/Git/Enable Force Push. After it is enabled you can check "Force Push" check box in the "Push" dialog.

Original answer

You have to do a force push, because topic branch is already published and you are rewriting history. Commits A and B from origin/topic are removed if you rebase.

You should make a merge if you don't want to do a force push, specially if you have a team members already working on topic.

You can't do a force push with SourceTree for Windows yet (see answers at atlassian forums). You can vote for this feature here: https://jira.atlassian.com/browse/SRCTREEWIN-338


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...