git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* Automating git add & commit for every change individually?
@ 2016-05-15  2:01 git.20.BrowserUk
  0 siblings, 0 replies; only message in thread
From: git.20.BrowserUk @ 2016-05-15  2:01 UTC (permalink / raw
  To: git

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2016-05-15  2:01 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-15  2:01 Automating git add & commit for every change individually? git.20.BrowserUk

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).