Re: Question about git



On Tue, May 26, 2009 at 3:30 PM, Tirumurti Vasudevan <agnihot3 gmail com> wrote:
> does running
>
> $ git reset --hard
>
> twice revert the local repo two times back?
> crazy question isn't it?

First of all, 'working copy' are the files that you see in each of the
repositories.
When you modify a file (such as by updating a translation), you make a change
to the working copy. This change is only added to the repository when
you commit it.
With 'git reset --hard', any uncommitted changes (to tracked files) in
the working
copy are lost, and (after 'git reset --hard') the files you see in the
repository
match exactly to what the repository is tracking.
How does the repository know what makes the working copy?
All the repository data files are stored in the .git/ subdirectory.

You can actually erase all files from the working copy and then do
'git reset --hard'
so that you can get them back. This would make sense if you want to backup
the repositories and copy to another computer.

Therefore, if you run 'git reset --hard' for a second time, then there
is no change
in the repository whatsoever.

However, if you run 'git reset --hard HEAD^', then you alter the
working copy to match
the state before the last commit. If you run this command repeatedly,
then each time you
remove a commit and your local repository goes back in time.

Similarly, if you run 'git reset --hard HEAD^^', then you lose the two
last commits at a time.

Simos


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]