TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

A safer git checkout

13 点作者 guybrush0大约 13 年前

5 条评论

bherms大约 13 年前
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?<p>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.<p>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.
评论 #4039145 未加载
评论 #4039148 未加载
billybob大约 13 年前
I've been using Git for a couple years now, and I don't think I've ever lost any work.<p>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.<p>Only if those commits stay orphaned for a while (a week or two?) will Git truly discard them.
评论 #4039289 未加载
shaggyfrog大约 13 年前
Dear author: the plural of alias is aliases.
评论 #4039536 未加载
hyprlogik大约 13 年前
Why not just use git stash?
bnr大约 13 年前
I don't see how git-cof is different/better than git-stash.
评论 #4039524 未加载