-1

First I have a master branch in my remote repo on the internet. And I know if I changed my local files, how to update my local changes to the remote repo. Now the problem is, if I don't want my new changes in my local tracked files, how to return back using updating from the remote repo in github?

I have tried the following things:

  1. I use

    git checkout origin master
    

    to get to master repo.

  2. I make sure that one tracked file, named main_32.f90 is changed a little bit in the comment line.

  3. Then I use

    git pull
    
  4. it turns out that everything is up to date.

    Already up-to-date.
    
  5. I then checked the main_32.f90, it is not the original one but the changed one in comment line. So it means that the git pull is not working.

So how to do it?

1 Answers1

1

If you don't want to keep your local changes, you can do a hard reset to a pointer, branch, sha1, etc to discard all changes. git reset --hard HEAD.

Use this kind of aliases to have a pretty view of your working tree if you are a console fan and don't want to use any GUI as suggested by other users.

Community
  • 1
  • 1
Avalanche
  • 1,468
  • 1
  • 11
  • 18
  • THanks! I just google that there are unofficial GUIs! I only knew that GITHUB for windows and mac. – ArtificiallyIntelligence Jul 01 '15 at 21:12
  • 2
    @PabPeter ```git status``` is your best friend when using terminal - it tells you what is going on with your working tree. One more advice, use ```git fetch``` before pulling - it will only update the remote refs, but not merge the changes (if any) from the remote repository (google the difference between ```fetch``` and ```pull```). – Avalanche Jul 01 '15 at 21:22