I am working on the game mod and want to manage the work I am doing on some VCS, i.e. github. The work is done on several files accross several subfolders. Thus it would be logical to have an entire game as a project. But I don't want to upload the entire game to github. It would be ideal if it was possible to manage just the files which were changed. That way it would be also eas(ier) to share this project with anyone who is insterested.
So, basically what I want is:
- the entire project on git locally
- only upload to git hub the files that have changed or/and the specific files (as per TTT comments below) I want to push to remote repo.
I saw similar question here: What is the best strategy to store in repository only changed files?
.gitignore is an option, but feels quite cumbersome. And managing this manually kind of defeats the point of having it on github to start with.
Also, the above link was for the question asked 6 years ago.
Any new ideas for this solution?
CodePudding user response:
Obviously the easiest way is to simply .gitignore everything except the files you would want to push, but you lose all the benefits of source control for everything else...
Although a little cumbersome, if you're willing to maintain two branches, this workflow would be pretty straight forward:
- A branch
branch-to-push
would contain commits that modify only the files you wish to push. - A branch
do-not-push
would contain everything you wish to track locally.
You would work out of do-not-push
, and anytime you wish to modify file(s) that you would want to push, switch to branch-to-push
, commit the change, then switch back to do-not-push
and merge in (or rebase onto) branch-to-push
.
CodePudding user response:
You can only add
and commit
files you want to be saved on Github. And other local files would be saved only on your computer
CodePudding user response:
Git by design requires that every commit contain every file. If you don't want that, you don't want Git (nor Mercurial, etc). Consider using an old file-oriented version control system such as RCS (though such systems are generally not distributed, and there's no convenient forge like GitHub for that).
CodePudding user response:
Git isn't really designed to do what you are asking here. If you commit files locally, then they will be uploaded to a remote repository (such as GitHub) when you do a git push
. There is no way to selectively upload files that you are tracking with git.