1

I've got a master branch and someone did a few changes in it which I don't want. Is it possible to undo the changes without committing?

Current status:

git status
On branch 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:   bazinga.php
        modified:   bazinga2.php

no changes added to commit (use "git add" and/or "git commit -a")

So basically revert to the old bazinga/bazinga2 files.

J. Sm
  • 27
  • 6

2 Answers2

2

One answer hides in the git status information

(use "git checkout -- ..." to discard changes in working directory)

Try to use the command below.

git checkout bazinga.php
git checkout bazinga2.php
Ben Lee
  • 102
  • 1
  • 1
  • 9
0

Setting your branch to exactly match the remote branch can be done

git fetch origin
git reset --hard origin/master

Or

git checkout .

Reference: Reset local repository branch to be just like remote repository HEAD

Community
  • 1
  • 1
Ayan
  • 2,300
  • 1
  • 13
  • 28