最新消息:20210816 当前crifan.com域名已被污染,为防止失联,请关注(页面右下角的)公众号

[已解决]git抛弃修改

Git crifan 3070浏览 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,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
90 queries in 0.167 seconds, using 22.11MB memory