1

Do I have to commit for my friends to see the code? I find it frustrating to write a commitment message every time I make a small change. If I am working with a team, there should be a quicker way, right?

canton7
  • 37,633
  • 3
  • 64
  • 77
Martis
  • 183
  • 1
  • 12
  • 7
    Yes, you do have to write meaningful commit messages, and that's a good thing. – bereal Feb 26 '16 at 13:31
  • When you make changes, they'll be in your filesystem only, not in the repo. When you commit, you're adding them to the repo. Your friends can't possibly get something that isn't in the repository. Simply commit and if in Zend Studio or some other IDE there may be an option to reuse an old commit message, although that's bad practice. You should always describe what your commit has changed. – i-CONICA Feb 26 '16 at 13:31

2 Answers2

3

Yes, you need to commit your changes before you can push anything. A push (and a pull) only transfers commit contents, so something that is not committed is not transferred.

So yes, you need to commit to be able to push your code, and no, there is no “quicker” way (I’d argue that it’s quick enough). In general, you shouldn’t just commit and share every small change though. You should commit changes that are semantically related and complete on their own. If you don’t have that, then you shouldn’t commit.

If you’re constantly sharing your tiny code changes, you should probably look for something else as that sounds more like remote pair programming. Something like a live collaborative coding environment.

poke
  • 369,085
  • 72
  • 557
  • 602
  • Thank you for your answer! Do you know any of the best remote pair programming environments? – Martis Feb 26 '16 at 13:36
  • Unfortunately, I don’t. But a quick Google search showed many results, including some that are integrated into code editors like Atom. So that could work rather well. – poke Feb 26 '16 at 13:42
1

Do i have to commit for my friends to see the code?

Yes, there is no other way for the Git system to know that this is not throw-away, experimental code that you are just trying out.

If i am working with a team, there should be a quicker way, right?

If you want to give uncommitted code to them, then try giving a patch file. However, if this is not just experimental code, I would strongly recommend you to commit and push.

I find it frustrating to write a commitment message every time i make a small change.

Well, for production code, giving meaningful commit messages is part of being a good engineer, you shouldn't feel wrong about it. If you are knowledgeable about the changes you made, which you should, writing a good commit message should not be an issue.

Community
  • 1
  • 1
legends2k
  • 31,634
  • 25
  • 118
  • 222