Spam Hackback
Spam Hackback

Reputation: 3

git copy historical changes as new

I have searched & tried a few things, but I can't figure this out.

There are two files that were modified last month, RPT and SQL in a remote repository. Some aggregation functionality was removed in the modifications. The task is not to revert the changes, but to get a copy of last month's versions of RPT and SQL and create them as RPT_with_agg and SQL_with_agg. (apparently now we want both kinds)

How do I ...

  1. find last month's version of the files (before the removal of aggregation)
  2. create copies of them in the remote repository with new names (without overwriting or changing the current no-aggregation versions in either my local or the remote repo)

I see bits and pieces of this in my searches, but I can't seem to put it all together. Can someone please help a newb? TIA

Upvotes: 0

Views: 19

Answers (1)

antlersoft
antlersoft

Reputation: 14786

I think this kind of thing is much easier with a GUI tool like GitExtensions, where you can browse the tree, select a file and see its history, select a version, then "Save as..." that version to a new filename.

If you want to use the command line, use "git log" to identify a commit before the changes in question. Then

git checkout [that commit id]

Copy the files you want the old version of to their new names. Then

git checkout [your working branch]

to go back to the present; the re-named files will be unchanged because they are not in the tree. Then

git add [new names of files]

-- and then commit.

Upvotes: 1

Related Questions