Perhaps I'm missing something, but in years of development using git as our scm, I have never used checkout -f. I've used reset --hard HEAD here and there. Is there any difference in their use?
Also, are there a lot of developers who work for hours without committing? I've only found myself in a situation where I could possibly lose hours of work a few times and each time this happens I realize I was treading thin ice.
Lastly, and maybe this is also just me, I keep my repos in Dropbox. Github is our main repo store, but I've got an extra level of protection, especially since Dropbox allows you to rollback file changes.
Can we all work on this? Somehow nobody seems to treat writing crappy commits (messages like "work since Tuesday" or "it works now") like they would writing crappy code. Version control is fundamental to our job.
It's funny -- I think this is where some of the conflict lies. With git, you can do a bunch of commits with crappy comments and then, when you are ready to publicize it (push, whatever), you can use rebase to pretty up your commit history. In other words, I take the analogy of "crappy commits" to "crappy code" a step further: the commit history is another document that is to be presented to other developers; make it helpful!
Most developers learn by example. I've looked for resources on using vcs properly but the few that existed weren't very good. A great resource would be a showcase for a collection of great commits. It doesn't exist as far as I know unfortunately.
as davvid says, the git project is an excellent place to start. The git project inherited a lot of its practices from the linux kernel project, but they are different enough to make looking at both interesting.
The archive for the git list is at [1].
The other great thing to look for is a well designed standard, with examples, for how a commit message should look. Most everyone who uses a standard uses The Standard* [2], so I would suggest you do the same.
* Except that many projects don't require the sign-off
I've been using Git for a couple years now, and I don't think I've ever lost any work.
Even if you do `git reset --hard HEAD~5`, "throwing away" your last few commits, they aren't actually discarded yet. You can do `git reflog` to see them and then `git checkout -b some_commit_hash` to recover one to a branch, or `git reset --hard some_commit-hash` to set this branch back to that point.
Only if those commits stay orphaned for a while (a week or two?) will Git truly discard them.
We make nouns out of adverbial/prepositional phrases often, and alias ("in other places [known as]" -> "a name by which one is known in another place") is just one example. We talk about items, but "item" is the adverb that means "also", and you'd find it in recipes: "2 eggs. Item: oil. Item: water.". (Less similarly, you'll see brochures called "take-ones".)
Git stash solves a different problem, which is "I want to save these changes, and get them back". git-cof is optimized for the use-case of "I want to get rid of these changes, and I'll probably never use them again".
The most obvious difference is that commits made with git-cof never show up in git log --oneline --graph; but also they get garbage collected automatically, you don't have to manually go through "git stash list".
Also, are there a lot of developers who work for hours without committing? I've only found myself in a situation where I could possibly lose hours of work a few times and each time this happens I realize I was treading thin ice.
Lastly, and maybe this is also just me, I keep my repos in Dropbox. Github is our main repo store, but I've got an extra level of protection, especially since Dropbox allows you to rollback file changes.