How to get the entire git repository

This question already has an answer here:

  • How do I force “git pull” to overwrite local files? 36 answers

  • Your repo's files are already inside the .git directory stored as git objects. You just need to switch your working copy's state to an untouched one.

    Run the following command from the root of your repo to unstage any changes you have in the git's staging area:

    git reset HEAD .
    

    Then run the following command, to discard all changes in the currently checked out branch:

    git checkout -- .
    

    git pull is required only if you need to fetch updated changes from the remote repository into your local one and merge the remote changes for the current branch into the local one. Based on what I understood from your question at least, git pull is not required.


    There are two simple way to reset your checkout:

    git checkout .
    

    This will reset your checkout to the state of your current branch.

    git reset --hard origin/master
    

    This will reset your checkout to the state of your remote tracking branch (assumed to be master). This is useful if you've made some commits locally, which you don't care to keep.

    链接地址: http://www.djcxy.com/p/4274.html

    上一篇: 如何避免合并冲突拉?

    下一篇: 如何获取整个git存储库