# Newbie in Git. How to get back from last pull?

6 messages from 2010-08-01 to 2010-08-01. Participants: Yankovsky, Ramkumar Ramachandra, Miles Bader, Andreas Schwab.
Thread: https://gitlist.dev/t/24598

## Yankovsky, 2010-08-01 08:06

Subject: Newbie in Git. How to get back from last pull?
Message-ID: <1280649966984-5360499.post@n2.nabble.com>
URL: https://gitlist.dev/e/1280649966984-5360499.post%40n2.nabble.com

```

Hi!
I have commited all my changes, and accidently typed git pull, then was
paniced and aborted the operation. now all my changes in project disappear.
but i have commit. how can i restore my project status using this commit?
I hope you understand my rus english)
Thanks.
-- 
View this message in context: http://git.661346.n2.nabble.com/Newbie-in-Git-How-to-get-back-from-last-pull-tp5360499p5360499.html
Sent from the git mailing list archive at Nabble.com.

```

## Ramkumar Ramachandra, 2010-08-01 08:30

Subject: Re: Newbie in Git. How to get back from last pull?
Message-ID: <20100801083000.GF26006@kytes>
URL: https://gitlist.dev/e/20100801083000.GF26006%40kytes
In-Reply-To: <1280649966984-5360499.post@n2.nabble.com>

```
Hi Yankovsky,

Yankovsky writes:
> I have commited all my changes, and accidently typed git pull, then was
> paniced and aborted the operation. now all my changes in project disappear.
> but i have commit. how can i restore my project status using this commit?
> I hope you understand my rus english)

I don't understand exactly what you want to do, but here are the
basics- you can decide what you want to do.
1. Use `git reflog` to see a history of your operations.
2. If you want your working copy to switch to an existing commit, use
   `git checkout <SHA1 of commit>`.
3. If you want to irreversibly destroy everything and switch your
   working copy to a desired commit, use `git reset --hard <SHA1 of
   commit>`. Use with care!

Hope that helps.

-- Ram

```

## Miles Bader, 2010-08-01 09:14

Subject: Re: Newbie in Git. How to get back from last pull?
Message-ID: <87bp9mbsp0.fsf@catnip.gol.com>
URL: https://gitlist.dev/e/87bp9mbsp0.fsf%40catnip.gol.com
In-Reply-To: <20100801083000.GF26006@kytes>

```
Ramkumar Ramachandra <artagnon@gmail.com> writes:
> I don't understand exactly what you want to do, but here are the
> basics- you can decide what you want to do.
> 1. Use `git reflog` to see a history of your operations.
> 2. If you want your working copy to switch to an existing commit, use
>    `git checkout <SHA1 of commit>`.
> 3. If you want to irreversibly destroy everything and switch your
>    working copy to a desired commit, use `git reset --hard <SHA1 of
>    commit>`. Use with care!

... and:  0. In "emergency recovery situations", _back up your whole
source dir (including .git subdir) somewhere else before screwing
around_!

E.g., "cp -a my_src_dir /somewhere_else/my_src_dir_backup"

-Miles

-- 
Pray, v. To ask that the laws of the universe be annulled in behalf of a
single petitioner confessedly unworthy.

```

## Andreas Schwab, 2010-08-01 09:32

Subject: Re: Newbie in Git. How to get back from last pull?
Message-ID: <m2k4oaptk0.fsf@igel.home>
URL: https://gitlist.dev/e/m2k4oaptk0.fsf%40igel.home
In-Reply-To: <87bp9mbsp0.fsf@catnip.gol.com>

```
Miles Bader <miles@gnu.org> writes:

> Ramkumar Ramachandra <artagnon@gmail.com> writes:
>> I don't understand exactly what you want to do, but here are the
>> basics- you can decide what you want to do.
>> 1. Use `git reflog` to see a history of your operations.
>> 2. If you want your working copy to switch to an existing commit, use
>>    `git checkout <SHA1 of commit>`.
>> 3. If you want to irreversibly destroy everything and switch your
>>    working copy to a desired commit, use `git reset --hard <SHA1 of
>>    commit>`. Use with care!
>
> ... and:  0. In "emergency recovery situations", _back up your whole
> source dir (including .git subdir) somewhere else before screwing
> around_!

IMHO the very first step should be to run "git status" and see what it
says.  With that information it would be much easier to recommend
further steps.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

```

## Yankovsky, 2010-08-01 10:02

Subject: Re: Newbie in Git. How to get back from last pull?
Message-ID: <1280656961746-5360639.post@n2.nabble.com>
URL: https://gitlist.dev/e/1280656961746-5360639.post%40n2.nabble.com
In-Reply-To: <20100801083000.GF26006@kytes>

```

Ramkumar, thank you!
it works!
Awesome)
-- 
View this message in context: http://git.661346.n2.nabble.com/Newbie-in-Git-How-to-get-back-from-last-pull-tp5360499p5360639.html
Sent from the git mailing list archive at Nabble.com.

```

## Yankovsky, 2010-08-01 10:11

Subject: Re: Newbie in Git. How to get back from last pull?
Message-ID: <1280657475602-5360649.post@n2.nabble.com>
URL: https://gitlist.dev/e/1280657475602-5360649.post%40n2.nabble.com
In-Reply-To: <87bp9mbsp0.fsf@catnip.gol.com>

```

yes, i did this)
Guys, thanks a lot!
really, i didn't expect help this quick!
-- 
View this message in context: http://git.661346.n2.nabble.com/Newbie-in-Git-How-to-get-back-from-last-pull-tp5360499p5360649.html
Sent from the git mailing list archive at Nabble.com.

```
