* git push requires a subsequent git reset --hard ?
@ 2008-07-01 16:51 Neshama Parhoti
2008-07-01 17:19 ` Jeff King
2008-07-01 17:29 ` Jakub Narebski
0 siblings, 2 replies; 6+ messages in thread
From: Neshama Parhoti @ 2008-07-01 16:51 UTC (permalink / raw)
To: git
Hi all,
I took with me a copy of a local repository to a week away from my station
(just rsync'ed it to my laptop).
On my return, I just "git push myuser@my-station:/my/git/repo" from my laptop.
It seemed to work with no probs.
On my station the git repo got the new commits, as I can see in
git-log, but the actual files were left untouched.
So I need to do something like "git reset --hard HEAD" to get
the changes into the local files.
Is that considered normal ?
or did I do something wrong ?
Thanks,
pnesh
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: git push requires a subsequent git reset --hard ?
2008-07-01 16:51 git push requires a subsequent git reset --hard ? Neshama Parhoti
@ 2008-07-01 17:19 ` Jeff King
2008-07-01 17:29 ` Jakub Narebski
1 sibling, 0 replies; 6+ messages in thread
From: Jeff King @ 2008-07-01 17:19 UTC (permalink / raw)
To: Neshama Parhoti; +Cc: git
On Tue, Jul 01, 2008 at 07:51:26PM +0300, Neshama Parhoti wrote:
> On my return, I just "git push myuser@my-station:/my/git/repo" from my laptop.
> It seemed to work with no probs.
> On my station the git repo got the new commits, as I can see in
> git-log, but the actual files were left untouched.
>
> So I need to do something like "git reset --hard HEAD" to get
> the changes into the local files.
>
> Is that considered normal ?
>
> or did I do something wrong ?
See:
http://git.or.cz/gitwiki/GitFaq#head-b96f48bc9c925074be9f95c0fce69bcece5f6e73
and
http://git.or.cz/gitwiki/GitFaq#head-46de97a5ac549d3adf406c22674b3325ae25d09c
What you did is OK, but there is a better way to do it.
-Peff
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: git push requires a subsequent git reset --hard ?
2008-07-01 16:51 git push requires a subsequent git reset --hard ? Neshama Parhoti
2008-07-01 17:19 ` Jeff King
@ 2008-07-01 17:29 ` Jakub Narebski
2008-07-02 13:36 ` Dmitry Potapov
2008-07-02 13:45 ` Dmitry Potapov
1 sibling, 2 replies; 6+ messages in thread
From: Jakub Narebski @ 2008-07-01 17:29 UTC (permalink / raw)
To: Neshama Parhoti; +Cc: git
"Neshama Parhoti" <pneshama@gmail.com> writes:
> I took with me a copy of a local repository to a week away from my station
> (just rsync'ed it to my laptop).
>
> On my return, I just "git push myuser@my-station:/my/git/repo" from my laptop.
> It seemed to work with no probs.
>
> On my station the git repo got the new commits, as I can see in
> git-log, but the actual files were left untouched.
>
> So I need to do something like "git reset --hard HEAD" to get
> the changes into the local files.
>
> Is that considered normal ?
This is considered normal. Push would never touch index nor working
area (although if you are the only user, and you know what you are
doing, you can add "git reset --hard HEAD" to post-receive hook). It
is the only way: "push" cannot be opposite of "pull" and do a merge
because there is nobody to resolve conflict on remote side.
So you should either do mirroring (1:1 refspec) push into bare
repository (without working directory), or push into remotes section,
remotes/satellite or remotes/mothership, like shown in GitFaq, below.
See also:
* "Why won't I see changes in the remote repo after "git push"?"
http://git.or.cz/gitwiki/GitFaq#head-b96f48bc9c925074be9f95c0fce69bcece5f6e73
* "How would I use "git push" to sync out of a firewalled host?"
http://git.or.cz/gitwiki/GitFaq#head-46de97a5ac549d3adf406c22674b3325ae25d09c
--
Jakub Narebski
Poland
ShadeHawk on #git
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: git push requires a subsequent git reset --hard ?
2008-07-01 17:29 ` Jakub Narebski
@ 2008-07-02 13:36 ` Dmitry Potapov
2008-07-04 13:25 ` Neshama Parhoti
2008-07-02 13:45 ` Dmitry Potapov
1 sibling, 1 reply; 6+ messages in thread
From: Dmitry Potapov @ 2008-07-02 13:36 UTC (permalink / raw)
To: Jakub Narebski; +Cc: Neshama Parhoti, git
On Tue, Jul 01, 2008 at 10:29:38AM -0700, Jakub Narebski wrote:
>
> This is considered normal. Push would never touch index nor working
> area (although if you are the only user, and you know what you are
> doing, you can add "git reset --hard HEAD" to post-receive hook).
Doing "reset --hard" makes all your uncommit changes to be lost.
OTOH, if you push on the local branch assotiated with HEAD then
recovering all uncommit changes later will not be easy either. So,
I wonder, if git push should require --force if you want to push
to the HEAD branch of a non-bare repo. It will be at least some
warning (especially for novices) to not to do that, and those who
really want to understand what they are doing can use --force.
Dmitry
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: git push requires a subsequent git reset --hard ?
2008-07-01 17:29 ` Jakub Narebski
2008-07-02 13:36 ` Dmitry Potapov
@ 2008-07-02 13:45 ` Dmitry Potapov
1 sibling, 0 replies; 6+ messages in thread
From: Dmitry Potapov @ 2008-07-02 13:45 UTC (permalink / raw)
To: Jakub Narebski; +Cc: Neshama Parhoti, git
On Tue, Jul 01, 2008 at 10:29:38AM -0700, Jakub Narebski wrote:
>_
> This is considered normal. Push would never touch index nor working
> area (although if you are the only user, and you know what you are
> doing, you can add "git reset --hard HEAD" to post-receive hook).
Doing "reset --hard" makes all your uncommitted changes to be lost.
OTOH, if you push on the local branch associated with HEAD then
recovering all uncommitted changes later will not be easy either. So,
I wonder, if git push should require --force to push to HEAD of a
non-bare repository. It will be at least some warning (especially for
novices) to not to do that, and those who understand what they are
doing can use --force.
Dmitry
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: git push requires a subsequent git reset --hard ?
2008-07-02 13:36 ` Dmitry Potapov
@ 2008-07-04 13:25 ` Neshama Parhoti
0 siblings, 0 replies; 6+ messages in thread
From: Neshama Parhoti @ 2008-07-04 13:25 UTC (permalink / raw)
To: Dmitry Potapov, peff; +Cc: Jakub Narebski, git
Thank you all for the replies !
I think git has one of the most supportive and friendly community !
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2008-07-04 13:26 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-01 16:51 git push requires a subsequent git reset --hard ? Neshama Parhoti
2008-07-01 17:19 ` Jeff King
2008-07-01 17:29 ` Jakub Narebski
2008-07-02 13:36 ` Dmitry Potapov
2008-07-04 13:25 ` Neshama Parhoti
2008-07-02 13:45 ` Dmitry Potapov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).