Hacker News new | past | comments | ask | show | jobs | submit login

You should be able to do this pretty easily. We list your other local and remote branches in the sidebar. If you apply them, they are essentially converted into virtual branches (remote targets too, I believe)



I think I got it working today. Not sure what I was doing wrong before.

Also, you I recommend that you add the capability to pull different hunks out of the commit, and separate/unsquash them, or even move them to different branches. The UI is begging me to drag parts of the commit out. I can squash commits, but it doesn't seem like I can do the opposite.

Use Case: Just now I made a change to a config file, and a build tool also updated the version in this same config file. I want to split the change out.

Using the CLI to split the commit, I would do this:

  git add -p <file>.              # partial stage
  s                               # for each hunk
For splitting the hunk into a branch, I would do this:

  git checkout -b new-branch-name
  git reset HEAD^                 # if I already staged it
  git add -p
  s                               # for each hunk
Using Magit, splitting out the commit:

  M-x magit-status
  TAB                             # on the file diff
  s                               # per hunk
  e                               # when I need to refine it manually
Using Magit, to move hunks to a different branch:

  M-x magit-status
  TAB                             # on the file diff
  b c                             # new branch
  <same process as before>
  b b                             # as needed, switch branches
Again, want to thank you for you work here. It's really nice, I already am getting my team onboarded to it.


So, yes and no. You should be able to do `reset HEAD^` equivalent by just hitting 'undo', which is essentially what that does. You can then re-commit stuff or drag the newly uncommitted hunks to other branches.

But it's only for the last commit, so something in the middle you can only squash, you can't unfold into two commits or something. Totally doable, but not in our UI yet. (we will do that someday)




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: