最新消息:20190717 VPS服务器:Vultr新加坡,WordPress主题:大前端D8,统一介绍入口:关于

[已解决]git抛弃修改

Git crifan 1095浏览 0评论
licrifandeMacBook-Pro:iOS-Client crifan$ git status
On branch master
Your branch is up-to-date with ‘origin/master’.
Changes not staged for commit:
  (use "git add <file>…" to update what will be committed)
  (use "git checkout — <file>…" to discard changes in working directory)
modified:   JianDao/.DS_Store
Untracked files:
  (use "git add <file>…" to include in what will be committed)
JianDao/JianDao.xcodeproj/project.xcworkspace/xcuserdata/crifan.xcuserdatad/WorkspaceSettings.xcsettings
JianDao/JianDao.xcodeproj/xcuserdata/crifan.xcuserdatad/xcdebugger/
no changes added to commit (use "git add" and/or "git commit -a")
licrifandeMacBook-Pro:iOS-Client crifan$ git checkout v1.0
error: Your local changes to the following files would be overwritten by checkout:
JianDao/.DS_Store
Please, commit your changes or stash them before you can switch branches.
Aborting
licrifandeMacBook-Pro:iOS-Client crifan$

想要去掉一些无所谓的修改:

git checkout — benchmarks.rb

git reset HEAD CONTRIBUTING.md

licrifandeMacBook-Pro:iOS-Client crifan$ git checkout — JianDao/.DS_Store
licrifandeMacBook-Pro:iOS-Client crifan$ git status
On branch master
Your branch is up-to-date with ‘origin/master’.
Untracked files:
  (use "git add <file>…" to include in what will be committed)
JianDao/JianDao.xcodeproj/project.xcworkspace/xcuserdata/crifan.xcuserdatad/WorkspaceSettings.xcsettings
JianDao/JianDao.xcodeproj/xcuserdata/crifan.xcuserdatad/xcdebugger/
nothing added to commit but untracked files present (use "git add" to track)
licrifandeMacBook-Pro:iOS-Client crifan$

然后就可以去切换了:

licrifandeMacBook-Pro:iOS-Client crifan$ git checkout v1.0
Switched to branch ‘v1.0’
Your branch is up-to-date with ‘origin/v1.0’.
licrifandeMacBook-Pro:iOS-Client crifan$ 

[总结]

想要丢弃某个文件的修改:

git checkout — someTag

转载请注明:在路上 » [已解决]git抛弃修改

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
63 queries in 0.087 seconds, using 18.61MB memory