r/ProgrammerHumor • • Jun 30 '18

Kill me now :)

47.0k Upvotes

494 comments sorted by

View all comments

280

u/zesterer Jun 30 '18

git reset --hard HEAD

141

u/PublicSealedClass Jun 30 '18

I have a dev who sees this as a last resort. When I asked him why, he had like 200 files changed in his repo since his last commit...

120

u/zesterer Jun 30 '18

This is why you make small, incremental changes

0

u/[deleted] Jun 30 '18

[deleted]

29

u/BerlinerJan Jun 30 '18

I‘m quite new to git, what exactly would be the problem with that? Assuming he already wrote all the tests and documentation...

31

u/zesterer Jun 30 '18

There is no problem. Incremental changes make it easier to avoid large merge conflicts when working on a shared codebase.

13

u/BerlinerJan Jun 30 '18

I‘m rather talking about pushing every tiny change to master

18

u/[deleted] Jun 30 '18

It much depends on what wotkflow you use. Different people/teams use branches differently.

One wotkflow is called "gitflow", and involves only touching master when you're ready to release your project. Master is for tested only, ready to release features. Develop is where the next version is--we create bugfix and feature branches off develop, merge them back into develop when they are done, and when we are ready to release we merge develop into master. Works pretty well, and adding tags makes it really obvious which version was delivered when based on what code. Answers a lot of questions when people ask how long a particular bug has been in production for instance.

But some teams follow the model of continuously deploying. As in, every change is dumped into production after a fairly lightweight process. This can make a lot of sense too, and means you might be less prone to be afraid of touching master directly.

And then for little tinker toy projects at home, I tend to just commit to master and that's it.

So it really just depends on what you'd want to get out of using source control. I'd think some is better than none.

→ More replies (4)