简体   繁体   中英

How do I git -commit everything except what is in a subdirectory?

I'm building my app on Openshift.

But I need to find out how I can run

git commit -m "Some reason" 

without affecting what is in a /users/* subdirectory. How would I do that?

You can do it with these steps:

  • add users folder to file .gitignore
  • git add .gitignore
  • git commit -m 'add users folder to gitignore'

After these steps folder users will be out of version control

git commit only commits the files & directories which you have staged for commit. So 'git add' only what you want to commit & you will be fine. If you run 'git status' you can see a list of what is staged for commit. Here's a good resource for more information on basic git flows: https://git-scm.com/book/en/v2/Git-Basics-Getting-a-Git-Repository

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