1

I have, due to various previous issues, renames, server changes, Xcode mishandling, etc, rewritten the history of my branch(es) using the technique described here.

However, one of my colleagues has uncommitted work from a branch that is currently not very compatible with the one the other people use. What I'd like is to be able to grab all the commits he's done from a trusted date and pull them in the correct branch(to save history)

I can show a log of my colleague's work using this solution, which would allow me, in the worst case, to grab manually every change and cherry pick the correct source from the latest version, knowing every change he made.

Can I actually filter from a given commit, since I know the hash of the commit he made when he started to work on the functionality we don't want to lose?

In order to see what I'm doing, I've added a prettifying option --pretty=format:"%H - %ad : %s".

I know there are tools, such as --since and --until, but when I do git log --author="colleagueLogin" --pretty=format:"%H - %ad : %s" --since commitHash, I get all his commits ever, so obviously, I'm doing it wrong.

Thanks to Twalberg's help, I understood I could skip the "making a clean log" step, and integrate the commits (which I now have clearly listed) by applying human intelligence to the list I have, e.g. start the cherry-picking process on the correct date. However, for the sake of knowledge, I'd still love to learn how to cut off git log --author="colleagueLogin" --pretty=format:"%H - %ad : %s" from the commit date I know he started the feature he worked on...

Community
  • 1
  • 1
Kheldar
  • 5,361
  • 3
  • 34
  • 63
  • Is `git cherry-pick ..` what you are looking for? You could achieve something similar with `git format-patch`/`git am`, but that's more work... – twalberg May 08 '14 at 17:56
  • Actually, I'd like to have all his work in a nicely packaged patch to apply to the existing code base in our branch, but I'm afraid it's a bit too complex for my git-skills. I looked into git diff, but I could not figure out how to pass it the arguments of my `git log`, and anyway the later do not work. I also tried adding HEAD~numberOfCommits, or --since=''..HEAD or --since=''..HEAD, but it doesn't list the commits I want. I'm reading through git format-patch now, thanks for the pointer! – Kheldar May 08 '14 at 18:02

0 Answers0