0

I am working on an open-source project that uses Mercurial.

I made a git repo inside the source directory and now have about 40-odd commits.

The project released a new version of the source-code and I now wish to apply the commits I made selectively.

What I mean is, among the various directories that exist, I want to replace only the src directory while ignoring all the updated library directories (Which I have not modified in any commit anyway)

Everytime I try a git checkout -b <branch> -t <remote/branch> I get an error saying I need to either move or remove tonnes of existing files

How can I go about doing this?

Paul S
  • 7,645
  • 2
  • 24
  • 36
Guru Prasad
  • 4,053
  • 2
  • 25
  • 43
  • you could try to `git stash && git checkout -b -t && git stash apply` – Rufinus Jun 08 '13 at 09:30
  • I'm a little confused, how do you have a "remote branch" if you created the git repo yourself? If you `git clone`d it from somewhere, sure... Did you use some conversion tool to convert from an hg repo to a git repo? – torek Jun 09 '13 at 01:20

1 Answers1

0

git cherry-pick <commit> will apply commit to the current repository. Use git stash before this commang and git stash pop after this command, if you have any unstaged changes.

Tsar Ioann
  • 444
  • 4
  • 9
  • This will also make `git merge` impossible since commit IDs will differ..wouldn't it? merge is a very useful functionality to have..could there be a non-intrusive way of achieving this? – Guru Prasad Jun 08 '13 at 15:05
  • @user1761555 Why would it make `merge` impossible? – Tsar Ioann Jun 08 '13 at 15:09
  • http://stackoverflow.com/questions/881092/how-to-merge-a-specific-commit-in-git/881112#881112 ..I may have misunderstood – Guru Prasad Jun 08 '13 at 15:22