Automating git add & commit for every change individually?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi, 

Not sure this is the right place; I couldn't find a mailing list specifically for git *users*?

Problem: Given two source trees, neither yet under source control. One (hereafter:MOD)containing extensive modifications of the other (hereafter:ORIG), I want to bring these together under source control such that I can, starting with the full MOD version, back out (and subsequently reinstate) changes individually.

And I mean individually at the 'group of lines' level; not the 'whole file' level.

Reason. The ORIG does not compile locally due to dependency on proprietary libraries I do not have access to. The MOD compiles locally and runs; but I have introduced an error that means it produces the wrong results. 

None of the changes required to remove the dependence on the proprietary libraries should have affected the functionality. Obviously, I must have touched something that wasn't required to achieve the local compile.

Some of those 'incidental' changes are obvious: the original source files contain some tabs; my editor is set to replace tabs with spaces. This shouldn't affect anything, but shows up in diffs. Some changes are habitual: manually adjusting whitespace and comments when trying to understand particular sections of code. Some are changes I made trying to achieve the compile -- addressing warnings like "Information may be lost." -- that probably weren't ultimately required to achieve the compile. These *could* affect the results produced.

Suggested solution:: Put the ORIG into git (init/add ./commit -am "Original"). Copy the modified subtree over the original. Add & Commit the changes in chunks.

Problem: It doesn't allow me to back out the changes individually; only commit sized chunks.

Suggested solution:: use git add -p to stage individual changes; and then commit it. Rinse & repeat.

Problem:This is extremely laborious and error prone.
Ie. If I do git -p; {spews 377 lines of diff}; Do you want to stage this hunk. I accept: 'Y'; now that hunk is staged; but not committed. So, I have to quit out of git -p; then git commit -m {make up some reason} repeat for the next 4000 changes.

Question 1:: Is there any way to automate the staging & committing of all existing changes as individual commits? Preferably with auto-generated commit messages.

Question 2:: Is there some other way get both versions into git such that I am to be able to 'undo' individual changes to the MOD version, try the build & test; and then redo the undone change if it wasn't the one that screwed things up?

Thanks, Buk

____________________________________________________________
Can't remember your password? Do you need a strong and secure password?
Use Password manager! It stores your passwords & protects your account.
Check it out at http://mysecurelogon.com/manager



--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]