Git keep some local changes clean but do not push them

Viewed 2719

I am working on the develop branch on my computer. I have done a lot of changes that I do not want to push, but I want to keep them. What I did is to change the translator behavior on my project and I would like to test it a little longer before pushing it and deploy it to production. But I would like to continue to work on develop or any other branches and be able to apply theses changes.

There is the ideas I came up with:

  1. Keep all of those files (do not git-add them) and commit only files I actually want to commit. But this solution make my "git status" very messy (lot of modified files) and I believe it will generate errors and lead to the commit of wrong file(s).

  2. Git stash save "Translation" and apply it when I want to use it. But I will have the same issue with a messy git status where I will have to choose which one of my files I want to commit or not.

  3. Create a new branch with my new feature on it, but as soon as I will merge it to my working branch I will commit the merge as the same time

Do you know any other workflow to keep a list of changes to a lot of files and apply/remove theses changes ?

6 Answers

One solution I have used is to have a second remote repository, with the branches and commits that I didn't want in the first repository.

You have to take care to make sure that you're pushing to the proper repository, but it does sound like it would meet the needs of your situation.

Related