Christina Zhou
Christina Zhou

Reputation: 1863

How to push everything to GitHub except one file

I want to push my whole project to GitHub except sql.py.

I have two remotes, actually, one to a shared network drive (that should continue to get the updated sql.py), and one to GitHub which has more privacy restrictions.

I tried making a .gitignore but this has the consequence of

  1. always ignoring sql.py
  2. also my file somehow went missing recently (receovered it with a backup).

Upvotes: 0

Views: 282

Answers (1)

Scott Murray
Scott Murray

Reputation: 26

Simply stage all files except for sql.py

Add all files

git add --all

Unstage the file you want to exclude

git reset HEAD -- sql.py

Commit your file

git commit -m "All project files"

Upvotes: 1

Related Questions