Various ways to remove local Git changes

前端 未结 9 951
难免孤独
难免孤独 2020-11-27 08:45

I just cloned a git repository and checked out a branch. I worked on it, and then decided to remove all my local changes, as I wanted the original copy.

In short, I

9条回答
  •  情话喂你
    2020-11-27 09:12

    The best way is checking out the changes.

    Changing the file pom.xml in a project named project-name you can do it:

    git status
    
    # modified:   project-name/pom.xml
    
    git checkout project-name/pom.xml
    git checkout master
    
    # Checking out files: 100% (491/491), done.
    # Branch master set up to track remote branch master from origin.
    # Switched to a new branch 'master'
    

提交回复
热议问题