git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* Working from different machines.
@ 2016-08-17 21:47 Tobiah
  2016-08-17 22:41 ` Junio C Hamano
  0 siblings, 1 reply; 7+ messages in thread
From: Tobiah @ 2016-08-17 21:47 UTC (permalink / raw)
  To: git

Right now I have a server at work where I keep a bare repository as
a source and backup for projects.  So I clone a project from there
to my desktop, and work, making a few branches as I try out ideas
for new features.

Then I go home, and I want to work as though I was sitting at my
desktop.  If I clone the committed work, I don't get all my branches.
How can I work so that I now easily have all my branches, then after
I work at home, when I go back to my desktop, the branches now reflect
whatever state I last left them in?

In other words, I want to work from different machines, and always
sit down to the environment exactly as I last left it.

Thanks!




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Working from different machines.
  2016-08-17 21:47 Working from different machines Tobiah
@ 2016-08-17 22:41 ` Junio C Hamano
  2016-08-18  6:10   ` Jacob Keller
                     ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Junio C Hamano @ 2016-08-17 22:41 UTC (permalink / raw)
  To: Tobiah; +Cc: git

Tobiah <toby@tobiah.org> writes:

> In other words, I want to work from different machines, and always
> sit down to the environment exactly as I last left it.

You have several options, but it depends on untold expectations you
have beyond "exactly as I last left it."  So the following is only
to show directions and possibilities without going into details.

For example, do you save all changes you made in your editor buffers
before you leave the 'desktop'?  If the answer is "no", then that is
not a problem Git-the-tool is interested in solving, and the only
solution I could think of is to use mechanism to share the session
between 'desktop' and 'home', using things like remote-desktop or
screen session.

If the answer is "yes", the next question is if you commit all the
changes you made before you leave the 'desktop'.  If the answer is
"no", again, that is not a problem Git-the-tool is interested in
solving, and the only solution I could think of (in addition to the
"share the session" above) is to use networked filesystem shared
between 'desktop' and 'home'.

If the answer is "yes", then you are in the problem space that
Git-the-tool is interested in solving.  Assuming that you have
network connection into 'desktop' from 'home', the solution would
involve making it the first thing to do when get home to run "git
fetch" on 'home' to get the latest state from the 'desktop', and run
"git push" on 'home' to push out the latest state to the 'desktop'
before you leave 'home'.  If your 'server' is for your sole use, and
if 'home' has network connection into 'server', then you could
instead rendezvous at 'server' by running "git push server" on
'desktop' (or 'home') to 'server' as the last thing before you leave
'desktop' (or 'home'), and running "git fetch server" on 'home' (or
'desktop') as the first thing before you start working on 'home' (or
'desktop').





^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Working from different machines.
  2016-08-17 22:41 ` Junio C Hamano
@ 2016-08-18  6:10   ` Jacob Keller
  2016-08-18 12:29   ` Jakub Narębski
  2016-08-18 14:11   ` Tobiah
  2 siblings, 0 replies; 7+ messages in thread
From: Jacob Keller @ 2016-08-18  6:10 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Tobiah, Git mailing list

On Wed, Aug 17, 2016 at 3:41 PM, Junio C Hamano <gitster@pobox.com> wrote:
> If the answer is "yes", then you are in the problem space that
> Git-the-tool is interested in solving.  Assuming that you have
> network connection into 'desktop' from 'home', the solution would
> involve making it the first thing to do when get home to run "git
> fetch" on 'home' to get the latest state from the 'desktop', and run
> "git push" on 'home' to push out the latest state to the 'desktop'
> before you leave 'home'.  If your 'server' is for your sole use, and
> if 'home' has network connection into 'server', then you could
> instead rendezvous at 'server' by running "git push server" on
> 'desktop' (or 'home') to 'server' as the last thing before you leave
> 'desktop' (or 'home'), and running "git fetch server" on 'home' (or
> 'desktop') as the first thing before you start working on 'home' (or
> 'desktop').
>
>

To add to this, you may need to modify the "git push" portion of the
phases and the "git fetch" potion to include all the branches you are
interested in.

Thanks,
Jake

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Working from different machines.
  2016-08-17 22:41 ` Junio C Hamano
  2016-08-18  6:10   ` Jacob Keller
@ 2016-08-18 12:29   ` Jakub Narębski
  2016-08-18 14:28     ` Tobiah
  2016-08-18 14:11   ` Tobiah
  2 siblings, 1 reply; 7+ messages in thread
From: Jakub Narębski @ 2016-08-18 12:29 UTC (permalink / raw)
  To: Junio C Hamano, Tobiah; +Cc: git

W dniu 18.08.2016 o 00:41, Junio C Hamano pisze:
> Tobiah <toby@tobiah.org> writes:

> [...] the next question is if you commit all the
> changes you made before you leave the 'desktop'. [...]
> 
> If the answer is "yes", then you are in the problem space that
> Git-the-tool is interested in solving.  Assuming that you have
> network connection into 'desktop' from 'home', the solution would
> involve making it the first thing to do when get home to run "git
> fetch" on 'home' to get the latest state from the 'desktop', and run
> "git push" on 'home' to push out the latest state to the 'desktop'
> before you leave 'home'.  If your 'server' is for your sole use, and
> if 'home' has network connection into 'server', then you could
> instead rendezvous at 'server' by running "git push server" on
> 'desktop' (or 'home') to 'server' as the last thing before you leave
> 'desktop' (or 'home'), and running "git fetch server" on 'home' (or
> 'desktop') as the first thing before you start working on 'home' (or
> 'desktop').

Two additional comments:

* First, `--mirror` might be what the relation between 'desktop'
  and 'home' repositories should be.

* Second, even if you can connect only from 'home' to 'desktop',
  but not from 'desktop' to 'home', the refspec mechanism of Git
  is flexible enough that you can emulate 'push' with 
  appropriately configured 'fetch', and vice versa.

-- 
Jakub Narębski


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Working from different machines.
  2016-08-17 22:41 ` Junio C Hamano
  2016-08-18  6:10   ` Jacob Keller
  2016-08-18 12:29   ` Jakub Narębski
@ 2016-08-18 14:11   ` Tobiah
  2 siblings, 0 replies; 7+ messages in thread
From: Tobiah @ 2016-08-18 14:11 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

On 08/17/2016 03:41 PM, Junio C Hamano wrote:
> Tobiah <toby@tobiah.org> writes:
>
>> In other words, I want to work from different machines, and always
>> sit down to the environment exactly as I last left it.
>
> You have several options, but it depends on untold expectations you
> have beyond "exactly as I last left it."  So the following is only
> to show directions and possibilities without going into details.
>
> For example, do you save all changes you made in your editor buffers
> before you leave the 'desktop'?  If the answer is "no", then that is
> not a problem Git-the-tool is interested in solving, and the only
> solution I could think of is to use mechanism to share the session
> between 'desktop' and 'home', using things like remote-desktop or
> screen session.
>
> If the answer is "yes", the next question is if you commit all the
> changes you made before you leave the 'desktop'.  If the answer is
> "no", again, that is not a problem Git-the-tool is interested in
> solving, and the only solution I could think of (in addition to the
> "share the session" above) is to use networked filesystem shared
> between 'desktop' and 'home'.
>
> If the answer is "yes", then you are in the problem space that
> Git-the-tool is interested in solving.  Assuming that you have
> network connection into 'desktop' from 'home', the solution would
> involve making it the first thing to do when get home to run "git
> fetch" on 'home' to get the latest state from the 'desktop', and run
> "git push" on 'home' to push out the latest state to the 'desktop'
> before you leave 'home'.  If your 'server' is for your sole use, and
> if 'home' has network connection into 'server', then you could
> instead rendezvous at 'server' by running "git push server" on
> 'desktop' (or 'home') to 'server' as the last thing before you leave
> 'desktop' (or 'home'), and running "git fetch server" on 'home' (or
> 'desktop') as the first thing before you start working on 'home' (or
> 'desktop').
>

I've done a poor job of expressing my need.  I'm only
speaking about the state of each git project directory.
Shared sessions or filesystems are not what I'm loolking
for.

As far as the master branch goes, I have no problem syncing
everything to the server, then pulling to a different
machine.  When I said I want everything to be the same
between the home and work machines, I meant with regard to
all of the other branches.  I want to easily create an
entire movable git environment that is indistinguishable
from machine to machine.

It looks like --mirror is close to what I am looking for.

Thanks

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Working from different machines.
  2016-08-18 12:29   ` Jakub Narębski
@ 2016-08-18 14:28     ` Tobiah
  2016-08-18 16:53       ` Jakub Narębski
  0 siblings, 1 reply; 7+ messages in thread
From: Tobiah @ 2016-08-18 14:28 UTC (permalink / raw)
  To: Jakub Narębski, Junio C Hamano; +Cc: git


>
> * First, `--mirror` might be what the relation between 'desktop'
>   and 'home' repositories should be.
>


Here's what I'm trying, am I in the right ballpark?

desk> git branch
* master
desk> git checkout -b banana
Switched to a new branch 'banana'
desk> echo 'message' > oracle
desk> git add oracle
desk> git commit -a -moracle
[banana 66e7823] oracle
  1 file changed, 1 insertion(+)
  create mode 100644 oracle
desk> git push --mirror
Counting objects: 3, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 260 bytes | 0 bytes/s, done.
Total 3 (delta 1), reused 0 (delta 0)
To toby@shells.rcsreg.com:/home/git/toby/exposmart
  * [new branch]      banana -> banana

# Then on another machine:

home> git branch
* master
## Forgot to 'pull' here, but it never shows new branches anyway
## I have to get them by name.  Can I automate that?

home> git checkout banana
Branch banana set up to track remote branch banana from origin.
Switched to a new branch 'banana'
home> cat oracle
message
home> echo 'other message' >> oracle
home> git commit -a -moracle2
[banana 78e6c45] oracle2
  1 file changed, 1 insertion(+)
home> git push --mirror
Counting objects: 36, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (22/22), done.
Writing objects: 100% (36/36), 2.90 KiB | 0 bytes/s, done.
Total 36 (delta 13), reused 14 (delta 4)
To shells.rcsreg.com:/home/git/toby/exposmart
    66e7823..78e6c45  banana -> banana
    7e01bf8..c65ed75  origin/HEAD -> origin/HEAD
  * [new branch]      origin/auto -> origin/auto
  * [new branch]      origin/banana -> origin/banana
  * [new branch]      origin/develop -> origin/develop
  * [new branch]      origin/flipper -> origin/flipper
  * [new branch]      origin/tart -> origin/tart
home> vi
home> git push --mirror
Total 0 (delta 0), reused 0 (delta 0)
To shells.rcsreg.com:/home/git/toby/exposmart
    66e7823..78e6c45  origin/banana -> origin/banana
home> git push --mirror
Everything up-to-date
home>

## Why do I have to push three times to get the 'Everyting up-to-date'
## message?  Why does it still mention 'flipper' and 'tart' and all
## other branches I've played with.  When I delte them locally, I want
## them to be deleted everywhere.  They just keep accumulating.
##
## Now back a the other machine


desk> git pull
remote: Counting objects: 5, done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 3 (delta 1), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done.
 From shells.rcsreg.com:/home/git/toby/exposmart
    66e7823..78e6c45  banana     -> origin/banana
There is no tracking information for the current branch.
Please specify which branch you want to merge with.
See git-pull(1) for details.

     git pull <remote> <branch>

If you wish to set tracking information for this branch you can do so with:

     git branch --set-upstream-to=origin/<branch> banana

desk> git branch
* banana
   master
desk> git pull origin banana
 From shells.rcsreg.com:/home/git/toby/exposmart
  * branch            banana     -> FETCH_HEAD
Updating 66e7823..78e6c45
Fast-forward
  oracle | 1 +
  1 file changed, 1 insertion(+)
desk> cat oracle
message
other message


## So it seems to have worked, but the more I go back and forth
## The more I seem to have eventual problems getting branches
## and changes.  Am I doing it right?


Thanks




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Working from different machines.
  2016-08-18 14:28     ` Tobiah
@ 2016-08-18 16:53       ` Jakub Narębski
  0 siblings, 0 replies; 7+ messages in thread
From: Jakub Narębski @ 2016-08-18 16:53 UTC (permalink / raw)
  To: Tobiah, Junio C Hamano; +Cc: git

W dniu 18.08.2016 o 16:28, Tobiah pisze:

> ## [...]  Why does it still mention 'flipper' and 'tart' and all
> ## other branches I've played with.  When I delte them locally, I want
> ## them to be deleted everywhere.  They just keep accumulating.

In case of non-mirror setup. Git wouldn't delete remote-tracking branches
(e.g. origin/tart) if branch in remote repository is deleted (e.g. tart
in origin repository); you need to prune (or set up to auto prune), e.g.

 $ git remote origin prune

-- 
Jakub Narębski


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2016-08-19  1:37 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-17 21:47 Working from different machines Tobiah
2016-08-17 22:41 ` Junio C Hamano
2016-08-18  6:10   ` Jacob Keller
2016-08-18 12:29   ` Jakub Narębski
2016-08-18 14:28     ` Tobiah
2016-08-18 16:53       ` Jakub Narębski
2016-08-18 14:11   ` Tobiah

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).