Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The origin repository has many branches and you have to relay your work on one of them: master -4.2 Sometimes this branch is hidden and you have to make it visible

...


Note: The branch: master is not the present locus of development – that 'branch' reflects the state of a tree that stayed in step with the former Avaya SVN tree. Almost certainly you wish to use: master -4.2 which is the real "master" as of November 2010

How to make branch master -4.2 visible and be positioned on it

Code Block
git checkout -b master-4.2 origin/master-4.2

Watch the following code-snipped to accomplish this

...

Code Block
[user@localhostsipxecs]$ git branch
* master
[user@localhostsipxecs]$ git branch -a
* master
  remotes/origin/HEAD -> origin/master
  remotes/origin/master
  remotes/origin/master-4.2
  remotes/origin/release-4.2
[user@localhostsipxecs]$ git checkout -b master-4.2 origin/master-4.2
Branch master-4.2 set up to track remote branch master-4.2 from origin.
Switched to a new branch 'master-4.2'
[user@localhostsipxecs]$ git status
# On branch master-4.2
nothing to commit (working directory clean)
[user@localhostsipxecs]$ git branch
  master
* master-4.2
[user@localhostsipxecs]$
Make your changes

Before starting working, you have to make sure that you are in sync with the latest source code. Assuming that you have to base your work on master -4.2 branch follow the steps from below:

ATTENTION: do not make any change or commit on master -4.2 branch. Always create a new branch for your changes

...

Code Block
git fetch origin //make sure that you are in sync with the remote repository (origin)
git checkout master-4.2 //move to master-4.2 branch, because we want to base our work on this
git rebase origin/master-4.2 //rebase your master-4.2 branch with the origin master-4.2 branch just to keep in sync with the latest source code
git checkout -b TEST //create an position to a new branch called TEST, the branch were your changes will be performed

...

Code Block
[user@localhostsipxecs]$ git checkout master-4.2
Switched to branch 'master-4.2'
[user@localhostsipxecs]$ git status
# On branch master-4.2nothingmasternothing to commit
(working directory clean)
[user@localhostsipxecs]$ git rebase origin/master-4.2
Current branch master-4.2 is up to date.
[user@localhostsipxecs]$ git status
# On branch master-4.2
nothing to commit (working directory clean)
[user@localhostsipxecs]$ git checkout -b TEST
Switched to a new branch 'TEST'
[user@localhostsipxecs]$ git status
# On branch TEST
nothing to commit (working directory clean)
[user@localhostsipxecs]$

****after all your changes are done****

[user@localhostsipxecs]$ git status
# On branch TEST
# Changed but not updated:
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#
#    modified:   sipXconfig/neoconf/etc/freeswitch/freeswitch.xml
#
no changes added to commit (use "git add" and/or "git commit -a")
[user@localhostsipxecs]$ git commit -a
[TEST 747365d] UC-TEST: Patch title
 1 files changed, 1 insertions(+), 1 deletions(-)
[user@localhostsipxecs]$ git status
# On branch TEST
nothing to commit (working directory clean)

...

In order to correctly generate a patch you have to make sure that your branch is rebased with the origin's master -4.2 branch, because while you performed your changes it is very likey

...

Code Block
git fetch origin //make sure that you are in sync with the remote repository (origin)
git checkout master-4.2 //move to master-4.2 branch, because we want to base our work on this
git rebase origin/master-4.2 //rebase your master-4.2 branch with the origin master-4.2 branch just to keep in sync with the latest source code
git checkout TEST //move to your branch
git rebase master-4.2 //keep in sync your branch with your master-4.2 branch that now is in sync with origin's master-4.2

If rebase cannot be performed automatically, git may require you to manually perform some changes.

...

Code Block
git format-patch master-4.2 -o <output directory>
Code Block
[user@localhostsipxecs]$ git format-patch master-4.2 -o /home/mirceac/patches/
/home/mirceac/patches/0001-UC-TEST-Patch-title.patch
[user@localhostsipxecs]$

...

Code Block
git checkout master-4.2 //move to master-4.2 branch
git fetch upstream //get latest code from upstream
git rebase upstream/master-4.2 //rebase your local master-4.2 branch repository with upstream
git status //to verify if your local branch has something that needs to be pushed to origin
git push origin +: //push on origin

NOTE: In order to automatically update a specific branch (master-4.2),
instead of git fetch upstream it is recommended to use:
git pull upstream master-4.2
This command will automatically align your master-4.2 branch with the upstream master-4.2 performing automatic rebase

...

  1. Perform any commit/rebase operation as explained above
  2. Merge changes on your local master -4.2 repository
  3. Push your master -4.2 repo on origin

   Commands:

Code Block
git checkout master-4.2  //move to master-4.2 branch
git rebase TEST //push TEST changes on top of your master-4.2 branch
git push origin +: //push your local master-4.2 branch on origin

Send your changes upstream: From your project's page, click the "pull request" button

...

If you encounter problems when rebasing or merging 'git mergetool' command can be used to launch graphical 3-way merging tool. Make sure that you run it from the root of your git repository.

Panel

git rebase master-4.2

  1. ... reports merge conflicts
    git mergetool
  2. launches your favorite merge tool (meld in my case)
  3. after you merge all conflicting changes
    git rebase --continue

...