{"thread":{"id":"42325","subject":"Automating git add & commit for every change individually?","startedAt":"2016-05-15T02:01:30Z","lastAt":"2016-05-15T02:01:30Z","messageCount":1,"participants":["git.20.browseruk@xoxy.net"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"286555","messageId":"C21C71EAD3C.0000026Agit.20.BrowserUk@xoxy.net","threadId":"42325","inReplyTo":null,"subject":"Automating git add & commit for every change individually?","fromName":"","fromEmail":"git.20.browseruk@xoxy.net","sentAt":"2016-05-15T02:01:30Z","receivedAt":"2016-05-15T02:01:30Z","isPatch":false,"sender":{"key":"git.20.browseruk@xoxy.net","avatar":null},"body":"Hi, \n\nNot sure this is the right place; I couldn't find a mailing list specifically for git *users*?\n\nProblem: 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.\n\nAnd I mean individually at the 'group of lines' level; not the 'whole file' level.\n\nReason. 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. \n\nNone 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.\n\nSome 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.\n\nSuggested solution:: Put the ORIG into git (init/add ./commit -am \"Original\"). Copy the modified subtree over the original. Add & Commit the changes in chunks.\n\nProblem: It doesn't allow me to back out the changes individually; only commit sized chunks.\n\nSuggested solution:: use git add -p to stage individual changes; and then commit it. Rinse & repeat.\n\nProblem:This is extremely laborious and error prone.\nIe. 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.\n\nQuestion 1:: Is there any way to automate the staging & committing of all existing changes as individual commits? Preferably with auto-generated commit messages.\n\nQuestion 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?\n\nThanks, Buk\n\n____________________________________________________________\nCan't remember your password? Do you need a strong and secure password?\nUse Password manager! It stores your passwords & protects your account.\nCheck it out at http://mysecurelogon.com/manager\n"}]}