I'll-Be-Back I'll-Be-Back - 1 year ago 58
Git Question

Git - Undo all the changes changes

Yesterday I did

git pull
which grab latest copy from Github repo.

I did some coding yesterday but I did not do
git add .

Now I want to reset what it was from yesterday - meaning remove all the work changes from yesterday back to original (last git pull).

How to do this?

$ git status
On branch develop
Your branch is behind 'origin/develop' by 5 commits, and can be fast-forwarded.
(use "git pull" to update your local branch)
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: app/Http/Kernel.php
modified: app/Http/routes.php
modified: composer.json
modified: database/seeds/DatabaseSeeder.php

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

Answer Source

If you did not git add and therefore did not git commit, and just want the state to look like yesterday, a simple hard reset will fix it.

git reset --hard