1

I have a commit in gerrit with three files in which there are two deleted files, But i don't want to merge those deleted changes. I have tried all sort of things with resetting those files, but as i am just checking out the change from gerrit, It doesn't seems to actually do anything.

This i have found on lot of places:

git add -u
git reset HEAD path/to/file
git commit

but didn't work. Does anyone know a way to accomplish this.

AMY
  • 248
  • 1
  • 10

2 Answers2

1

To delete the files via git.

 git rm path/to/filename

I did this test. Clone an existing git repo to deleteme. Removed the README file from the repo and commit the changes.

 $git clone /path/tomy/gitrepo deleteme
 $cd deleteme
 $rm README
 $git commit -a


 # Please enter the commit message for your changes. Lines starting
 # with '#' will be ignored, and an empty message aborts the commit.
 # On branch master
 # Changes to be committed:
 #   (use "git reset HEAD <file>..." to unstage)
 #
 #       deleted:    README
 #

~
~
~
~

mirk
  • 442
  • 4
  • 13
  • How will this work when I dont even have that file in current checked out branch – AMY Mar 05 '14 at 15:58
  • You can still call this command on the deleted files. What if you just do git commit -a? Do you see the removed files in the log? – mirk Mar 05 '14 at 16:02
0

What you need to do. is cherry-pick the change-set from gerrit. And than in interactive fashion merge only the file you want. More details: partly cherry-picking a commit with git

Community
  • 1
  • 1
stdcall
  • 27,613
  • 18
  • 81
  • 125