* How to checkout a branch (and not a tag)
@ 2021-04-11 23:04 Jeffrey Walton
2021-04-11 23:22 ` Junio C Hamano
0 siblings, 1 reply; 3+ messages in thread
From: Jeffrey Walton @ 2021-04-11 23:04 UTC (permalink / raw)
To: Git List
I'm trying to checkout a branch called REL1_35 from
https://github.com/wikimedia/mediawiki-skins-Cosmos. The repo also has
a tag called REL1_35.
When I perform the following I apparently get the tag (with old files)
and not the branch (with updated files):
wiki_rel=REL1_53
...
git fetch origin && git reset --hard "origin/${wiki_rel}" && \
git checkout -f "${wiki_rel}" && git pull && git clean -xdf
I found https://groups.google.com/g/git-users/c/FfzGmqj6sNQ, but I am
not following it. My .git/config looks like it is using the proper
reference:
# cat skins/Cosmos/.git/config
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[remote "origin"]
url = https://github.com/Universal-Omega/MediaWiki-Cosmos-skin.git
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "REL1_35"]
remote = origin
merge = refs/heads/REL1_35
How do I checkout the branch (and not a tag)?
Thanks in advance.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: How to checkout a branch (and not a tag)
2021-04-11 23:04 How to checkout a branch (and not a tag) Jeffrey Walton
@ 2021-04-11 23:22 ` Junio C Hamano
2021-04-11 23:29 ` Jeffrey Walton
0 siblings, 1 reply; 3+ messages in thread
From: Junio C Hamano @ 2021-04-11 23:22 UTC (permalink / raw)
To: Jeffrey Walton; +Cc: Git List
Jeffrey Walton <noloader@gmail.com> writes:
> I'm trying to checkout a branch called REL1_35 from
> https://github.com/wikimedia/mediawiki-skins-Cosmos. The repo also has
> a tag called REL1_35.
>
> When I perform the following I apparently get the tag (with old files)
> and not the branch (with updated files):
>
> wiki_rel=REL1_53
Hopefully this typo is not part of what contributed to your problem.
Assuming that you actually used REL1_35 here...
> ...
> git fetch origin && git reset --hard "origin/${wiki_rel}" && \
...this should get their branches in refs/remotes/origin/, and would
reset whatever local branch you are on to origin/REL1_35. So at this
point, HEAD is the same as their REL1_35 branch.
> git checkout -f "${wiki_rel}"
And this causes the tag/REL1_35, which was obtained from them, to be
checked out to a detached HEAD.
What are you trying to do here? Do you want your own local REL1_35
branch, that starts at the same commit as their REL1_35 branch? If
so, then instead of that "checkout", you would probably do
git checkout -b REL1_35
Or whole thing up to this point would be
git fetch origin &&
git checkout -t -b REL1_35 origin/REL1_35
and then after this, your "git pull" while on your REL1_35 brnch
would integrate with their REL1_35 branch [*]
[Footnote]
* Unless you have other funny configuration variables in the
repository possibly from earlier random hacking, that is.
Depending on the state of the repository before you started the
"git fetch origin" step, commands like "git pull" and "git push"
would behave differently.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: How to checkout a branch (and not a tag)
2021-04-11 23:22 ` Junio C Hamano
@ 2021-04-11 23:29 ` Jeffrey Walton
0 siblings, 0 replies; 3+ messages in thread
From: Jeffrey Walton @ 2021-04-11 23:29 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Git List
On Sun, Apr 11, 2021 at 7:22 PM Junio C Hamano <gitster@pobox.com> wrote:
>
> Jeffrey Walton <noloader@gmail.com> writes:
>
> > I'm trying to checkout a branch called REL1_35 from
> > https://github.com/wikimedia/mediawiki-skins-Cosmos. The repo also has
> > a tag called REL1_35.
> >
> > When I perform the following I apparently get the tag (with old files)
> > and not the branch (with updated files):
> >
> > wiki_rel=REL1_53
>
> Hopefully this typo is not part of what contributed to your problem.
> Assuming that you actually used REL1_35 here...
Yes, typo.
> > ...
> > git fetch origin && git reset --hard "origin/${wiki_rel}" && \
>
> ...this should get their branches in refs/remotes/origin/, and would
> reset whatever local branch you are on to origin/REL1_35. So at this
> point, HEAD is the same as their REL1_35 branch.
>
> > git checkout -f "${wiki_rel}"
>
> And this causes the tag/REL1_35, which was obtained from them, to be
> checked out to a detached HEAD.
>
> What are you trying to do here? Do you want your own local REL1_35
> branch, that starts at the same commit as their REL1_35 branch?
I want an exact copy of the remote branch.
After I get that copy, I usually delete unneeded fodder, like test
gear and documentation.
Jeff
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-04-11 23:29 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-11 23:04 How to checkout a branch (and not a tag) Jeffrey Walton
2021-04-11 23:22 ` Junio C Hamano
2021-04-11 23:29 ` Jeffrey Walton
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).