-
Couldn't load subscription status.
- Fork 1
Fetch
You use the push command to transfer new command data from a downstream store back to its upstream. To transfer data the other way, you use the fetch command.
To demonstrate this, first open the origin store and add a further name to the work branch.
C:\Alt> altcmd origin/work
work[5]> name Colin
work[6]> ls -a
/origin
* /origin/work (ahead of parent by 2)
_/origin/work/steve (behind parent by 1)
Colin is known only to the work branch. If you wanted to, you could easily merge him into the parent branch because that is another local branch. But the work/steve branch is a remote. If you switch to that branch and try to merge, it won't work:
work[6] cd steve
_work/steve[2]> merge ..
Attempt to mutate remote branch
Remember that all remote branches are read-only. This applies to both upstream and downstream branches. To get Colin into work/steve, you need to open the downstream store.
_work/steve[2]> exit
C:\Alt> altcmd steve/work/+
work/+[2]> ls -a
^/steve
^/steve/work
* /steve/work/+ (ahead of parent by 1)
At this stage, the /steve/work/+ branch still thinks that it is ahead of the parent branch because it does not know what the origin has done with the work that was previously pushed. (TODO: It should show that it has already been pushed)
work/+[2]> fetch
To fetch 3 commands from 1 branch
Fetch [3,5] for work
Fetch completed
work/+[2]> ls -a
^/steve
^/steve/work (ahead of parent by 2)
* /steve/work/+ (behind parent by 1)
2 commands in 1 local branch
10 commands in 2 remote branches
Fetch copies command data from the upstream store to the corresponding branches in the downstream. But, like the push command, this does not automatically merge the newly arrived data into local branches. That is why /steve/work/+ is now behind the parent. To bring the latest name into the branch, it needs to be explicitly merged.
work/+[2]> merge ..
work/+[3]> ls -a
^/steve
^/steve/work (ahead of parent by 2)
* /steve/work/+
3 commands in 1 local branch
10 commands in 2 remote branches
