Reomanded usage?
From: MichaelTiloDressel@t-online.de <hidden>
Date: 2016-06-15 22:43:03
Hi,
I would like to get your opinion on the way I used cogito in the
following
example. In particular I would like to know if the command
"cg-switch -fr origin master" is the recommended usage in this case.
The situation: I have cloned a repository from some "original" repo.
I made some changes and committed them into my repo. Now I don't want to
push my changes into the "original" repo but instead I want to get
the latest changes from the "original" repo (with out my changes) and
continue
to work on them. I want to keep my changes to be able to introduce
them into the "original" repo at some later point.
I think I need to create a branch with my changes. With the master
branch I
need to go back to where I started from the "original" repo. And then
I can update my master from the "original" repo.
That's the way I did it:
cg-status
Heads:
>master 0176cac7fddc64d55ff5cad49e04567c402c3970
R origin 0176cac7fddc64d55ff5cad49e04567c402c3970
R otest 25ea047321cd15dd32eb7d6e0b51d86ee1668453
# do some changes
cg-commit -m .....
Committed as 7002e00d13e1227349897996db0fb27e9a1232a9
cg-status
Heads:
>master 7002e00d13e1227349897996db0fb27e9a1232a9
R origin 0176cac7fddc64d55ff5cad49e04567c402c3970
R otest 25ea047321cd15dd32eb7d6e0b51d86ee1668453
# more changes
cg-commit -m ..........
Committed as c43629cb3a382e89b13eef1193122db1bba8a243
cg-status
Heads:
>master c43629cb3a382e89b13eef1193122db1bba8a243
R origin 0176cac7fddc64d55ff5cad49e04567c402c3970
R otest 25ea047321cd15dd32eb7d6e0b51d86ee1668453
# now I want to go back to the commit before my changes and update
# to the latest commit in the origin and go on with some other work from
# that latest commit
# and keep my changes in a local branch (or head)
# create new head using cg-switch
cg-switch -c expect
Creating new branch expect: c43629cb3a382e89b13eef1193122db1bba8a243
Switching to branch expect...
cg-status
Heads:
>expect c43629cb3a382e89b13eef1193122db1bba8a243
master c43629cb3a382e89b13eef1193122db1bba8a243
R origin 0176cac7fddc64d55ff5cad49e04567c402c3970
R otest 25ea047321cd15dd32eb7d6e0b51d86ee1668453
# go back to my master
cg-switch master
Switching to branch master...
cg-status
Heads:
expect c43629cb3a382e89b13eef1193122db1bba8a243
>master c43629cb3a382e89b13eef1193122db1bba8a243
R origin 0176cac7fddc64d55ff5cad49e04567c402c3970
R otest 25ea047321cd15dd32eb7d6e0b51d86ee1668453
# now reset the master to the origin I started from
cg-switch -fr origin master
Repointing branch master: c43629cb3a382e89b13eef1193122db1bba8a243 ->
0176cac7fd
dc64d55ff5cad49e04567c402c3970
Switching to branch master...
cg-status
Heads:
expect c43629cb3a382e89b13eef1193122db1bba8a243
>master 0176cac7fddc64d55ff5cad49e04567c402c3970
R origin 0176cac7fddc64d55ff5cad49e04567c402c3970
R otest 25ea047321cd15dd32eb7d6e0b51d86ee1668453
# update my master with the current commit in the original repository
cg-update
Fetching pack (head and objects)...
remote: Generating pack...
remote: Done counting 1 objects.
remote: Deltifying 1 objects.
remote: 100% (1/1) done
remote: Total 1 (delta 0), reused 0 (delta 0)
Unpacking 1 objects
100% (1/1) done
Fetching tags...
Tree change:
0176cac7fddc64d55ff5cad49e04567c402c3970..9495c6fd42aefa745d937bf7b
b50ea138b4dc919
Applying changes...
Fast-forwarding 0176cac7fddc64d55ff5cad49e04567c402c3970 ->
9495c6fd42aefa745d93
7bf7bb50ea138b4dc919
on top of 0176cac7fddc64d55ff5cad49e04567c402c3970 ...
cg-status
Heads:
expect c43629cb3a382e89b13eef1193122db1bba8a243
>master 9495c6fd42aefa745d937bf7bb50ea138b4dc919
R origin 9495c6fd42aefa745d937bf7bb50ea138b4dc919
R otest 25ea047321cd15dd32eb7d6e0b51d86ee1668453
Best regards,
Michael