3

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.

Yohaï-Eliel Berreby
  • 1,165
  • 3
  • 14
  • 25

1 Answers1

3

If you can:

  • isolate all those intermediate commit on a fix branch
  • push that fix branch as many time as needed
  • pull from the fix branch 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.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • 2
    Ideally, 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