1

I'm wondering whehter the following git workflow might be possible:

  • Autocommit (and maybe autopush) on file save to some branch (i.e. auto-commit)
  • When done with current task, review all changes
  • Extract changes to specific regions (i.e. functions, classes, whatever) into new meaningful commits, preferably by using a visual tool (tig?)
  • Merge those new commits into master (or dev)

So basically, is there a way to visually extract changes to specific regions into new commits?

Philip Kamenarsky
  • 2,757
  • 2
  • 24
  • 30
  • Why would you want to do this? It seems to run counter to why you would be using source control on the other "regions" of your codebase in the first place, if you only want to merge some changes back into your `master` branch. – Sebastian Lenartowicz Sep 08 '16 at 13:02
  • I want to be able to experiment without having to think about meaningfully naming commits while being "in the zone". Later, when/if something comes out of that I'd like to go back and slice and extract the things that I want to keep into named commits. – Philip Kamenarsky Sep 08 '16 at 13:25
  • Interactive rebasing is made to handle this sort of scenario perfectly. You would rebase the `auto-commit` branch onto itself, breaking up the commits as you want, then just merge into master or whatever. – Mad Physicist Sep 08 '16 at 14:05
  • Possible duplicate of [Break a previous commit into multiple commits](http://stackoverflow.com/questions/6217156/break-a-previous-commit-into-multiple-commits) – Mad Physicist Sep 08 '16 at 14:08

0 Answers0