Git Merging Guide

From Funtoo Linux
Revision as of 22:16, 16 December 2011 by Drobbins (Talk)

Jump to: navigation, search

This page is here to show Funtoo Linux developers different techniques that can be used to merge various things.

Comparing Experimental and Master

The best way to get a quick and dirty understanding of the differences between experimental and master is to do this:

# cd /root/git/funtoo-overlay
# git diff --stat origin/master origin/experimental

This will show a summary of what modifications where made on a file-by-file basis.

Package Replacement: Funtoo Overlay (branch to branch)

When merging in funtoo-overlay, we might want to merge things from experimental to master. To do this, first pick a specific package to compare changes:

# cd /root/git/funtoo-overlay
# git diff --stat origin/master origin/experimental app-shells/bash
 app-shells/bash/bash-3.1_p17.ebuild   |  150 -------------------------
 app-shells/bash/bash-3.2_p51.ebuild   |  199 ---------------------------------
 app-shells/bash/bash-4.0_p37.ebuild   |  193 --------------------------------
 app-shells/bash/bash-4.0_p38.ebuild   |  193 --------------------------------
 app-shells/bash/bash-4.1_p10.ebuild   |  191 -------------------------------
 app-shells/bash/bash-4.1_p7-r1.ebuild |  189 -------------------------------
 app-shells/bash/bash-4.1_p9-r1.ebuild |  189 -------------------------------
 app-shells/bash/bash-4.2_p10.ebuild   |    5 +-
 8 files changed, 2 insertions(+), 1307 deletions(-)

This diff above shows that several ebuilds were removed in the experimental branch, and bash-4.2_p10.ebuild had slight modifications. To inspect further, specify the modified ebuild directly and drop the --stat option:

# git diff origin/master origin/experimental app-shells/bash/bash-4.2_p10.ebuild
diff --git a/app-shells/bash/bash-4.2_p10.ebuild b/app-shells/bash/bash-4.2_p10.ebuild
index 0c497ea..e603c15 100644
--- a/app-shells/bash/bash-4.2_p10.ebuild
+++ b/app-shells/bash/bash-4.2_p10.ebuild
@@ -37,7 +37,7 @@ SRC_URI="mirror://gnu/bash/${MY_P}.tar.gz $(patches)
 
 LICENSE="GPL-3"
 SLOT="0"
-KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~sparc-fbsd ~x86-fbsd"
+KEYWORDS="*"
 IUSE="afs bashlogger examples mem-scramble +net nls plugins vanilla"
 
 DEPEND=">=sys-libs/ncurses-5.2-r2
@@ -69,7 +69,6 @@ src_unpack() {
        cd lib/readline
        [[ ${READLINE_PLEVEL} -gt 0 ]] && epatch $(patches -s ${READLINE_PLEVEL} readline ${READLINE_VER})
        cd ../..
-       
        epatch "${FILESDIR}"/${PN}-4.1-document-system-bashrc.patch
 }
 
@@ -104,7 +103,7 @@ src_compile() {
        myconf="${myconf} --with-curses"
 
        myconf="${myconf} --without-lispdir" #335896
-       
+
        use plugins && append-ldflags -Wl,-rpath,/usr/$(get_libdir)/bash
        econf \
                $(use_with afs) \

OK, these look like changes we want to merge into the master branch. To do this, we want to wipe out what is currently in the master branch related to app-shells/bash, and replace it entirely with the exact contents of app-shells/bash in the experimental branch.

This can be done as follows:

# git rm -rf app-shells/bash
# git checkout origin/experimental -- app-shells/bash

Now, let's review the changes we made:

# git diff --cached --stat
 app-shells/bash/bash-3.1_p17.ebuild   |  150 -------------------------
 app-shells/bash/bash-3.2_p51.ebuild   |  199 ---------------------------------
 app-shells/bash/bash-4.0_p37.ebuild   |  193 --------------------------------
 app-shells/bash/bash-4.0_p38.ebuild   |  193 --------------------------------
 app-shells/bash/bash-4.1_p10.ebuild   |  191 -------------------------------
 app-shells/bash/bash-4.1_p7-r1.ebuild |  189 -------------------------------
 app-shells/bash/bash-4.1_p9-r1.ebuild |  189 -------------------------------
 app-shells/bash/bash-4.2_p10.ebuild   |    5 +-
 8 files changed, 2 insertions(+), 1307 deletions(-)

Looks good. These changes are already staged for commit -- notice the --cached option above. Let's commit them:

# git commit -m "bash updates from experimental"
# git push origin master

If we made any local changes to existing files that had not yet been added, and wanted to include those with the commit, we could use the -a option with git commit, above. Once the commit has been made, you should no longer see anything related to app-shells/bash listed when doing a diff of the branches.

Personal tools
Namespaces

Variants
Actions
Categories
Toolbox
Stuff