简体   繁体   中英

Remove files from commit made by git merge

I am quite newbie with git.

I have master branch and feature branch. I merged master branch to my feature branch ( as pull request complained about conflicts ).

However the merge commited files i do not want to track ( from .idea folder ). So my commit looks something like:

  .idea
     ...
  .src
     ...

Now if i push the commit i push also files i do not want on remote. Is there a way how to remove these files from the commit and keep other files commited?

Thanks for help!

You could list the files in that idea directory in the .gitignore file.

Alternatively, you could delete the files entirely so they are no longer tracked if that's what you desire:

git rm -r --cached <folder>

Note that files will be removed (including for other developers' machines when they next perform git pull ).

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