News for hackers. Stuff that matters.
Re:GitHub for Mac 1.1 by solutionyogi on Wednesday November 23, 2011 @04:18PM (#3271778)
Line Committing is a killer feature. Right now, I force myself to check in code for the smallest change because I want my commit to reflect a meaningful change. I could certainly save a lot of time if I had the flexibility to make bunch of changes in the file and then commit them in separate hunks.
Re:GitHub for Mac 1.1 by cyen on Wednesday November 23, 2011 @04:20PM (#3271788)
You can already from the command line! git add -p (short for --patch) will let you individual hunks of a file to the staging area.
Re:GitHub for Mac 1.1 by munificent on Wednesday November 23, 2011 @04:35PM (#3271849)
GitX supports that. I mainly use the command line for working with git, but I use GitX for committing because it has a great UI for seeing diffs and staging individual chunks.
Re:GitHub for Mac 1.1 by zpao on Wednesday November 23, 2011 @04:22PM (#3271798)
You've always been able to do that via the command line (`git add -p <file>`) but it's definitely great to see it in a more user friendly form.
Re:GitHub for Mac 1.1 by daemianmack on Wednesday November 23, 2011 @04:26PM (#3271813)
Sort of. -p considers consecutive lines a single hunk. Often, that's not what I want. Luckily, there is magit: http://philjackson.github.com/magit/
Re:GitHub for Mac 1.1 by troels on Wednesday November 23, 2011 @04:35PM (#3271851)
You can split the hunks into smaller ones.
Re:GitHub for Mac 1.1 by daemianmack on Saturday November 26, 2011 @12:03PM (#3280164)
You can split hunks until they're consecutive lines. You can't split more granularly than that with -p. You'd need to edit the patch, either directly or with git gui or similar.
Re:GitHub for Mac 1.1 by rbonvall on Wednesday November 23, 2011 @05:50PM (#3272145)
And you can also edit the patch manually.
Re:GitHub for Mac 1.1 by rmgraham on Wednesday November 23, 2011 @08:52PM (#3272659)
I resisted the edit option of git-add -p for a long time because I was afraid of messing something up with a low level tool... big mistake! So easy to use!
Re:GitHub for Mac 1.1 by bostonvaulter2 on Thursday November 24, 2011 @03:35AM (#3273661)
Plus if you make a patch that doesn't apply it will just error out and you can try again. And if you add anything extra by mistake you can easily back it out with something like git reset HEAD <file> or git reset -p
Re:GitHub for Mac 1.1 by solutionyogi on Wednesday November 23, 2011 @04:30PM (#3271828)
Yes, I am aware of git add -p but if you deal file with 500 lines of code, it's easier to have a UI to select lines you want to commit.
Re:GitHub for Mac 1.1 by Argorak on Thursday November 24, 2011 @02:08AM (#3273487)
By the way, is it possible to have git add -p show uncommitted files, like darcs does?
Re:GitHub for Mac 1.1 by bostonvaulter2 on Thursday November 24, 2011 @03:34AM (#3273657)
Not directly, but you can use git add -p for that. Although I don't think you get to review it first.
Re:GitHub for Mac 1.1 by pjscott on Wednesday November 23, 2011 @06:37PM (#3272304)
If you use emacs, magit-mode is great for this.

http://philjackson.github.com/magit/

Re:GitHub for Mac 1.1 by davvid on Wednesday November 23, 2011 @07:12PM (#3272407)
[shameless plug] http://git-cola.github.com/ can do by-line and by-hunk editing of both the index and work tree. It's had this feature since early 2008 ;-)

I find it easier to do it with a GUI vs. with `git add -p`.

Re:GitHub for Mac 1.1 by barumrho on Wednesday November 23, 2011 @05:02PM (#3271953)
There is also "git add -i" for that.