This is how I move master to branchX in git:
$ git checkout master #move HEAD to master $ git branch -f branchX HEAD #move by force, HEAD to branchX Is there a way to do that in Magit?
In this example, I want to move master to wstudent-topic2:
It is not clear what you want to do but since my attempt to get you to explain in more detail what you want (or to get moderators of this site to close the issue because you don't do that) have failed, I am answering some questions that you did not actually ask.
Based on the screenshot (but for the most part ignoring what you have written) I am going to assume that your question is one of:
How do I merge topic2 into master?
Type m m topic2 RET.
If you put the cursor on the add f2 line first, then you could also just m m RET because topic2 would be the default in that case.
How do I reset master so that it points at the same commit as topic2?
In a situation like the one in the screenshot you should just merge topic2 as I have just described. But if the situation looked like this instead:
* [master] something else | * [topic2] add f2 |/ * add f1 * add f0 Then a merge would result in this:
* [master] Merge branch 'topic2' |\ | * [topic2] add f2 * | something else |/ * add f1 * add f0 Maybe that's what you want - I have no way of knowing. But if you want this instead:
* [master] [topic2] add f2 * add f1 * add f0 then move to the [topic2] add fs line and type C-u x RET.
git branch -f <branchname> <startpoint>will reset<branchname>to commit<startpoint>. In your case, this will not affectmasterbranch in any way. Instead, this will basically, aliasmasterasbranchX. I'm not sure why would you want to do it, and I never tried to do this frommagit. Can you explain what's the end-result you want to achieve?