From: Petr Baudis <pasky@suse.cz>
To: Jan Wielemaker <wielemak@science.uva.nl>
Cc: git@vger.kernel.org
Subject: Re: Howto request: going home in the middle of something?
Date: Thu, 18 Oct 2007 13:27:58 +0200 [thread overview]
Message-ID: <20071018112758.GN18279@machine.or.cz> (raw)
In-Reply-To: <200710181144.22655.wielemak@science.uva.nl>
Hi,
On Thu, Oct 18, 2007 at 11:44:22AM +0200, Jan Wielemaker wrote:
> I've somewhere seen it in a mail, but I can't find it anymore. I have a
> bare central (public) repository and clones on various machines I work
> on. We all know it, you're right in the middle of something and it is
> really time to go home. You want to pick up your work at home, but
> without pushing to the shared repository.
>
> I'm sure GIT can do this elegantly, but I'm not yet sure how. I guess
> Ideally I want "git stash" at work, transfer the stashed changes to my
> other machine and apply them. How do I do that?
>
> Alternatively, I guess, one can commit at machine A, fetch the commit
> from machine A and continue. I'm still too uncertain about the remote
> access options to work this out properly, but it also feels less
> clean.
this should be pretty simple assuming SSH access to machine A. Git can
fetch over SSH, so it's merely about telling it that repository X is
available over ssh over there and it'll fetch it home.
The exact setup depends on whether you want to do this just once or
semi-regularily. If the former, just
git pull git+ssh://a.machine.aero/absolute/path
Note that this should fetch only the remote master branch, if I'm not
mistaken.
If the latter, tell your home repository about your work repository:
git remote add workrepo git+ssh://a.machine.aero/absolute/path
Then, you can anytime just
git fetch workrepo
and it will fetch all the branches from workrepo; whether you want to
use git fetch and git merge or git pull depends on your local
arrangement of branches at home.
So, basically, when fetching you deal with your work repository
exactly the same way as in the shared repository.
When pushing, this is not so trivial. Git _allows_ you to just push to
your work repository, but if you push to a branch that is currently
checked out, unexpected things will happen - always avoid that. If you
can fetch from home at work, do. If not, at least push to a branch at
work that can never be checked out and is reserved for that purpose.
--
Petr "Pasky" Baudis
Early to rise and early to bed makes a male healthy and wealthy and dead.
-- James Thurber
next prev parent reply other threads:[~2007-10-18 11:28 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-18 9:44 Howto request: going home in the middle of something? Jan Wielemaker
2007-10-18 10:37 ` Johannes Sixt
2007-10-18 11:07 ` Karl Hasselström
2007-10-18 11:27 ` Petr Baudis [this message]
2007-10-22 8:44 ` Jan Wielemaker
2007-10-22 11:32 ` Johannes Schindelin
2007-10-23 17:56 ` Jing Xue
2007-10-23 18:38 ` Jan Wielemaker
2007-10-23 20:28 ` Matthias Kestenholz
2007-10-24 13:44 ` Jing Xue
2007-10-18 11:29 ` Andy Parkins
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=20071018112758.GN18279@machine.or.cz \
--to=pasky@suse.cz \
--cc=git@vger.kernel.org \
--cc=wielemak@science.uva.nl \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
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;
as well as URLs for NNTP newsgroup(s).