* Copy branch into master
@ 2011-11-28 18:25 Ron Eggler
2011-11-28 18:36 ` Andrew Eikum
0 siblings, 1 reply; 7+ messages in thread
From: Ron Eggler @ 2011-11-28 18:25 UTC (permalink / raw)
To: git
Hi,
Some time ago I created a DVT branch in my project and I have almost been
exclusively working in it. Now the time for some test deployment came and I
didn't have time to merge it all back into the master thus I gave out the
DVT branch version. Now I would like to copy exactly what I have in that
branch back into my master to have an exact copy in my master of what got
deployed with out any changes.
How can I do this?
Please advise.
Thank you!
Ron
--
Ron Eggler
1804 - 1122 Gilford St.
Vancouver, BC
V6G 2P5
(778) 230-9442
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Copy branch into master
2011-11-28 18:25 Copy branch into master Ron Eggler
@ 2011-11-28 18:36 ` Andrew Eikum
2011-11-28 19:08 ` Ron Eggler
2011-11-29 12:49 ` Tay Ray Chuan
0 siblings, 2 replies; 7+ messages in thread
From: Andrew Eikum @ 2011-11-28 18:36 UTC (permalink / raw)
To: Ron Eggler; +Cc: git
On Mon, Nov 28, 2011 at 10:25:33AM -0800, Ron Eggler wrote:
> Some time ago I created a DVT branch in my project and I have almost been
> exclusively working in it. Now the time for some test deployment came and I
> didn't have time to merge it all back into the master thus I gave out the
> DVT branch version. Now I would like to copy exactly what I have in that
> branch back into my master to have an exact copy in my master of what got
> deployed with out any changes.
> How can I do this?
Couple options, depending on what you want:
Rename DVT to master (similar to 'mv DVT master', including
losing the contents of 'master'):
$ git checkout --detach HEAD
$ git branch -M DVT master
$ git checkout master
Retain old master (like 'mv master old_master; mv DVT master'):
$ git checkout --detach HEAD
$ git branch -m master old_master
$ git branch -m DVT master
$ git checkout master
The "checkout --detach" is just so Git doesn't complain about
moving/deleting the currently checked out branch.
If you haven't yet, be sure to read ProGit, which should make
questions like this trivial for you to answer yourself in the future:
<http://progit.org/book/>
Hope this helps,
Andrew
^ permalink raw reply [flat|nested] 7+ messages in thread
* RE: Copy branch into master
2011-11-28 18:36 ` Andrew Eikum
@ 2011-11-28 19:08 ` Ron Eggler
2011-11-28 19:26 ` Andrew Eikum
2011-11-29 12:49 ` Tay Ray Chuan
1 sibling, 1 reply; 7+ messages in thread
From: Ron Eggler @ 2011-11-28 19:08 UTC (permalink / raw)
To: 'Andrew Eikum'; +Cc: git
Thanks for that,
I guess I'd go for renaming DVT to master.
However, I also played around with merge a little, started a merge (in
Windows GUI) and aborted it but the icon of my directory keeps showing the
ywellow exclemation mark, signing that a merge is going on right now but
going into the directory, all the files are with a geen check mark. What's
going on here? How do I resolve this - I don't wanna mess things up so I
might rather resolve this before moving DVT to master.
Thanks,
Ron
-----Original Message-----
From: Andrew Eikum [mailto:aeikum@codeweavers.com]
Sent: Monday, November 28, 2011 10:36 AM
To: Ron Eggler
Cc: git@vger.kernel.org
Subject: Re: Copy branch into master
On Mon, Nov 28, 2011 at 10:25:33AM -0800, Ron Eggler wrote:
> Some time ago I created a DVT branch in my project and I have almost been
> exclusively working in it. Now the time for some test deployment came and
I
> didn't have time to merge it all back into the master thus I gave out the
> DVT branch version. Now I would like to copy exactly what I have in that
> branch back into my master to have an exact copy in my master of what got
> deployed with out any changes.
> How can I do this?
Couple options, depending on what you want:
Rename DVT to master (similar to 'mv DVT master', including
losing the contents of 'master'):
$ git checkout --detach HEAD
$ git branch -M DVT master
$ git checkout master
Retain old master (like 'mv master old_master; mv DVT master'):
$ git checkout --detach HEAD
$ git branch -m master old_master
$ git branch -m DVT master
$ git checkout master
The "checkout --detach" is just so Git doesn't complain about
moving/deleting the currently checked out branch.
If you haven't yet, be sure to read ProGit, which should make
questions like this trivial for you to answer yourself in the future:
<http://progit.org/book/>
Hope this helps,
Andrew
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Copy branch into master
2011-11-28 19:08 ` Ron Eggler
@ 2011-11-28 19:26 ` Andrew Eikum
2011-11-28 19:30 ` Ron Eggler
0 siblings, 1 reply; 7+ messages in thread
From: Andrew Eikum @ 2011-11-28 19:26 UTC (permalink / raw)
To: Ron Eggler; +Cc: git
On Mon, Nov 28, 2011 at 11:08:33AM -0800, Ron Eggler wrote:
> I guess I'd go for renaming DVT to master.
>
> However, I also played around with merge a little, started a merge (in
> Windows GUI) and aborted it but the icon of my directory keeps showing the
> ywellow exclemation mark, signing that a merge is going on right now but
> going into the directory, all the files are with a geen check mark. What's
> going on here? How do I resolve this - I don't wanna mess things up so I
> might rather resolve this before moving DVT to master.
>
Sorry, I have no idea how to use any of the GUI tools. Perhaps your
GUI tool has a mailing list where you can ask about merge conflict
resolution?
Andrew
^ permalink raw reply [flat|nested] 7+ messages in thread
* RE: Copy branch into master
2011-11-28 19:26 ` Andrew Eikum
@ 2011-11-28 19:30 ` Ron Eggler
2011-12-01 19:43 ` Neal Kreitzinger
0 siblings, 1 reply; 7+ messages in thread
From: Ron Eggler @ 2011-11-28 19:30 UTC (permalink / raw)
To: 'Andrew Eikum'; +Cc: git
> Sorry, I have no idea how to use any of the GUI tools. Perhaps your
> GUI tool has a mailing list where you can ask about merge conflict
> resolution?
No problem, I actually got it all figured out now, and got my branch
smoothly merged back into master.
Thanks for your help!
Ron
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Copy branch into master
2011-11-28 19:30 ` Ron Eggler
@ 2011-12-01 19:43 ` Neal Kreitzinger
0 siblings, 0 replies; 7+ messages in thread
From: Neal Kreitzinger @ 2011-12-01 19:43 UTC (permalink / raw)
To: git; +Cc: 'Andrew Eikum', git
On 11/28/2011 1:30 PM, Ron Eggler wrote:
>> Sorry, I have no idea how to use any of the GUI tools. Perhaps your
>> GUI tool has a mailing list where you can ask about merge conflict
>> resolution?
>
> No problem, I actually got it all figured out now, and got my branch
> smoothly merged back into master.
>
That is not what you originally asked for. What you asked for was:
"Now I would like to copy exactly what I have in that branch back into
my master to have an exact copy in my master of what got deployed with
out any changes." If you did a git-merge then what you did was combine
master with DVT. That most likely did not make master equal to DVT. If
you run the following git-diff the results will likely show they do not
match:
$ git-diff --name-only sha1-of-master-after-DVT-merge
sha1-of-DVT-before-merge-to-master
If you merge branch A into branch B it does not make branch B equal to
branch A. It makes branch B a combination of branch B and branch A
(plus your merge conflict resolutions). If you truly want to make
master exactly match DVT then I recommend the following: (I'm assuming
this is not a superproject containing submodules, and that you are using
linux. I am using git 1.7.1.)
(Return master to the state it was in when you asked the question)
(1) git checkout master
(2) git branch BKUP-master-DVT-merge (backup your current post-merge
master to another branch)
(3) git reset --hard sha1-of-master-before-merge
(Return DVT to the state it was in when you asked the question)
(1) git checkout DVT
(2) git branch BKUP-DVT-B4-merge (backup current DVT if it has new work)
(3) git reset --hard sha1-of-DVT-before-merge
(Make master match DVT exactly)
(1) Use the "vendor branch code drop" method described in the git-rm
manpage* (see note on permissions below). (Use the git-archive command
to create your tarball of DVT for this.)
(2) After "vendor branch code drop" is committed, git-diff --name-status
master DVT (they should match, ie. no results that matter)
(3) git-tag the resulting commit to make it clear this is the version
you deployed.
*Note: if you are tracking permissions in git (executable vs.
non-executable bits) then you will need to accomodate and validate
permissions in your git-archive and/or ensure permissions are set
properly before committing your vendor branch code drop. Otherwise, you
will have permissions changes that do not exactly match DVT.
I recommend trying the above on a test copy of your repo to verify the
results are really what you want.
(tar up your repo as root to retain permissions, and untar in test dir)
(repo path = /home/me/MY-REPO)
(1) pwd ( = /home/me)
(2) mkdir test
(3) su root
(4) pwd ( = /home/me)
(5) tar -cvzf MY-REPO.tar.gz MY-REPO/
(6) cd test
(7) mv ../MY-REPO.tar.gz .
(8) tar -xvzf MY-REPO.tar.gz
(test repo path = /home/me/test/MY-REPO)
(9) exit
(10) cd /home/me/test/MY-REPO
(11) try out what I said on test/MY-REPO and then decide if you want to
do it on the real me/MY-REPO.
If you already have additional commits on master after your master-DVT
merge then they are backed up in the BKUP-master-DVT-merge branch you
made earlier. These commits can then be interactively rebased on your
remediated master. (Be aware of any possible unique master-DVT merged
code the new commits are dependent on. If so, that code needs to be
reincorporated instead of being unwittingly lost.)
All the above assumes that others have not already pulled your
master-DVT merge and based their work on it. If they have already
pulled your new master and based work on it then it may be too late for
this to be practical, or additional steps would be needed for others to
properly remediate. I'm assuming you have a known set of developers
pulling from you. It is possible for them to interactively rebase their
new work onto your remediated master and take the merged-master out of
their history. (Be aware of any possible unique master-DVT merged code
the new commits are dependent on. If so, that code needs to be
reincorporated instead of being unwittingly lost.)
Hope this helps.
v/r,
neal
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Copy branch into master
2011-11-28 18:36 ` Andrew Eikum
2011-11-28 19:08 ` Ron Eggler
@ 2011-11-29 12:49 ` Tay Ray Chuan
1 sibling, 0 replies; 7+ messages in thread
From: Tay Ray Chuan @ 2011-11-29 12:49 UTC (permalink / raw)
To: Andrew Eikum; +Cc: Ron Eggler, git
On Tue, Nov 29, 2011 at 2:36 AM, Andrew Eikum <aeikum@codeweavers.com> wrote:
> On Mon, Nov 28, 2011 at 10:25:33AM -0800, Ron Eggler wrote:
>> Some time ago I created a DVT branch in my project and I have almost been
>> exclusively working in it. Now the time for some test deployment came and I
>> didn't have time to merge it all back into the master thus I gave out the
>> DVT branch version. Now I would like to copy exactly what I have in that
>> branch back into my master to have an exact copy in my master of what got
>> deployed with out any changes.
>> How can I do this?
>
> Couple options, depending on what you want:
>
> Rename DVT to master (similar to 'mv DVT master', including
> losing the contents of 'master'):
> $ git checkout --detach HEAD
> $ git branch -M DVT master
> $ git checkout master
It might not be wise to take the strict definition of rename = move
(copy + delete). You will lose *all* your reflog associated with
master. The old master is gone forever.
Resetting the branch is "safer". It's like pseudo-copying the branch.
The reflog for both branches are still around. You can do this with
# on master
$ git reset --hard DVT
or
# not on master
$ git branch -f master dvt
--
Cheers,
Ray Chuan
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2011-12-01 19:44 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-28 18:25 Copy branch into master Ron Eggler
2011-11-28 18:36 ` Andrew Eikum
2011-11-28 19:08 ` Ron Eggler
2011-11-28 19:26 ` Andrew Eikum
2011-11-28 19:30 ` Ron Eggler
2011-12-01 19:43 ` Neal Kreitzinger
2011-11-29 12:49 ` Tay Ray Chuan
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).