public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Matthieu Moy <Matthieu.Moy@imag•fr>
To: git <git@vger•kernel.org>
Subject: git push to a non-bare repository
Date: Sun, 18 Mar 2007 18:31:21 +0100	[thread overview]
Message-ID: <vpq648ye9w6.fsf@olympe.imag.fr> (raw)

Hi,

I have a repository with a working tree on a machine A, did a clone to
another machine B and commited there locally.

I want my changes to get back into the first repository, so I did a
"push". The new commit is in the history, I can see it with "git log",
but the modifications are not in the working tree.

This time, it's OK: I didn't have any uncommited modifications on A,
so I just did a "git reset --hard HEAD" there.

But if I had some uncommited changes, "git reset --hard HEAD" means
data loss, which is precisely what I want to avoid by using a VCS. It
seems a solution is to do:

$ git reset --soft <commit-id-before-the-push>
$ git merge <commit-id-after-the-push>

But it means I have to remember <commit-id-before-the-push>.


I don't understand the design choice here: git had two options to
avoid this scenario:

1) update the working tree while doing the push. That's feasible with
   good performance since git is present on the server, but leaves the
   problem of possible conflicts.

2) let git remember what the local tree points to (not just the branch
   name, but the commit id itself, stored in a place that "git push"
   won't modify). Then, provide me a way to "update" to the latest
   revision.

Fyi, bzr does this. Indeed, in bzr, a branch (let's say "repository"
in the git vocabulary) with a working tree just means a working tree
(AKA lightweight checkout) located in the same directory as a branch.
The working tree knows which revision it corresponds to, and where to
find its branch. There's a "bzr update" command to get my working tree
to the head of the branch, keeping the uncommited changes.

I believe this idea is very much linked to the "Lightweight Checkout"
idea (listed on the SoC ideas), since, in the case of multiple working
directories sharing the same .git, you don't want a commit in one tree
to affect the others.

So, did I miss something? Is there anything on the todo-list?

Thanks,

-- 
Matthieu

             reply	other threads:[~2007-03-18 17:31 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-18 17:31 Matthieu Moy [this message]
2007-03-18 19:47 ` git push to a non-bare repository Junio C Hamano
2007-03-18 21:51   ` Sam Vilain
2007-03-18 22:01     ` Jakub Narebski
2007-03-18 22:18     ` Junio C Hamano
2007-03-19  2:00 ` Theodore Tso
2007-03-19  1:55   ` Junio C Hamano
2007-03-19  2:21     ` Shawn O. Pearce
2007-03-19  2:47       ` Theodore Tso
2007-03-19  2:56         ` Shawn O. Pearce
2007-03-19  3:21           ` Theodore Tso
2007-03-19  3:53             ` Shawn O. Pearce
2007-03-19  4:08               ` Nicolas Pitre
2007-03-19  6:25                 ` Theodore Tso
2007-03-19  6:44                   ` Junio C Hamano
2007-03-19 15:20                     ` Nicolas Pitre
2007-03-19 15:16                   ` Nicolas Pitre
2007-03-19 23:58               ` Sam Vilain
2007-03-20  0:49                 ` Junio C Hamano
2007-03-20  0:54                   ` Junio C Hamano
2007-03-19  3:33           ` Theodore Tso
2007-03-19  3:47             ` Shawn O. Pearce
2007-03-19  4:14               ` Junio C Hamano
2007-03-19  9:19   ` Matthieu Moy
2007-03-19 10:01     ` Jakub Narebski
2007-03-21 17:20     ` Neil Schemenauer
2007-03-19 12:44 ` Sergio Callegari

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=vpq648ye9w6.fsf@olympe.imag.fr \
    --to=matthieu.moy@imag$(echo .)fr \
    --cc=git@vger$(echo .)kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox