From: git.20.BrowserUk@xoxy.net
To: git@vger.kernel.org
Subject: Automating git add & commit for every change individually?
Date: Sat, 14 May 2016 18:01:30 -0800 [thread overview]
Message-ID: <C21C71EAD3C.0000026Agit.20.BrowserUk@xoxy.net> (raw)
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
reply other threads:[~2016-05-15 2:01 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=C21C71EAD3C.0000026Agit.20.BrowserUk@xoxy.net \
--to=git.20.browseruk@xoxy.net \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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 NNTP newsgroup(s).