What's the git equivalent of “svn update -r”?

后端 未结 7 1790
一个人的身影
一个人的身影 2021-02-01 12:16

I\'m a recent git convert. It\'s great to be able to use git-svn to keep my branches locally without disturbing the svn server. There was a bug that existed in the latest versio

相关标签:
7条回答
  • 2021-02-01 12:51

    This seems to do what I wanted, which is what I think you're asking for too

    git checkout *
    
    0 讨论(0)
  • 2021-02-01 12:57

    Update 2019: the proper command would be

    git restore -s @~1
    

    (to, for instance, restore files at their state in HEAD parent commit)

    That is because:

    • git checkout is too confusing, dealing both with branches and files.
      git restore only... restore files, since Git 2.23 (August 2019).
      No need for git checkout HEAD~ -- .
    • Git 1.8.4 introduced @ as a shortcut notation for HEAD.
    0 讨论(0)
  • 2021-02-01 13:02

    If you are using TortoiseGit then

    Right Click in project folder > TortoiseGit > Pull
    
    0 讨论(0)
  • 2021-02-01 13:03

    And getting back to latest (equivalent to: svn up), you'll need to update the branch, usually:

    git checkout master
    

    This is because the HEAD refers to the version that is being checked out.

    0 讨论(0)
  • 2021-02-01 13:04

    There is no exact equivalent of svn update in git. If you delete a file, it will show as deleted status even if you pull it again. Only option is to checkout that file. If you have deleted multiple files by mistake and want to bring back them, You could rename that repo and clone it once again. This is what i do.

    0 讨论(0)
  • 2021-02-01 13:10
    git pull 

    seems a more appropriate command for what you are looking for

    0 讨论(0)
提交回复
热议问题