简体   繁体   中英

Remove a file change from a git commit

I have two file changes in a git commit. I have sent a pull request and still it is not merged. I need to know the command of removing one file change from the pull request. I mean not to delete the file from the repository. But to to remove new local changes from my commit. Please advice me.Thanks

我相信您必须这样做:

git reset --soft HEAD^ 

You can use

git reset --soft HEAD~1

and then reset the unwanted file

git reset HEAD /path_to_the_file

and you can commit again.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM