I use git to code on my desktop, test the changes, commit and push to the server. Everything was well until yesterday; I was debugging a subtle network issue with a project, and I had to get a fast feedback loop - seeing the output quickly to learn more about the problem, rince and repeat.
What I ended up doing is git commit -am "trying to fix bug X" && git push on my desktop, and git pull, compile and run on the server.
I know this isn't the right way to use it, so I'm wondering, how should I have used git? I couldn't test my changes (as in, send requests to the network) on my desktop, so I needed the server to execute the new code.
Asked
Active
Viewed 72 times
3
Yohaï-Eliel Berreby
- 1,165
- 3
- 14
- 25
1 Answers
3
If you can:
- isolate all those intermediate commit on a
fixbranch - push that
fixbranch as many time as needed - pull from the
fixbranch on the server
Once the bug is fix, squash the commits of fix on master, and push master.
Reset the server repo on origin/master.
-
2Ideally, you use a separate server for this (not your production server), and use a script/hook that automatically pulls from the fix branch whenever you push. – nwinkler Mar 05 '15 at 10:41