Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
考虑一下我已经准备好提交一个db/schema.rb我不打算更改的文件(例如 )。我需要去做:
db/schema.rb
git reset db/schema.rb git checkout db/schema.rb
我可以通过单个命令来完成吗?
我试过这个,对我来说效果很好:
git checkout HEAD -- path
我刚刚将此添加到我的.zshrc/.bashrc
.zshrc
.bashrc
checkout() { git reset "*$1*" git checkout "*$1*" }
然后你就可以做checkout <file>,你都准备好了。
checkout <file>