Versions Compared

Key

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

...

Run the commands from below:

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
git status //to verify what files are new and what are changed
git add <file_path> //if there are newly created files on your branch
git commit -a //commit your work

use git commit -a --amend if you want that your changes to be on top on a previous commit - in this way all will be included in a single patch

NOTE: for every commit will be generated one single patch (unless git commit -a --amend was used)

When git commit -a is used a vi editor is opened. Please the comments about the patch there and use :wq to actually write the changes (perform the commit)

git commt -a --amend will preserve previous commit comments and changes

Code Block

TEST: Test Title

Description
# Please enter the commit message for your changes. Lines starting# with '#' will be ignored, and an empty message aborts the commit.
# Committer: Mircea Carasel
# On branch TEST
# Changes to be committed:
#   (use "git reset HEAD ..." to unstage)
#       modified:   sipXconfig/neoconf/etc/freeswitch/freeswitch.xml
#~   

As a rule, after the title a blank line should be inserted and then the patch description

Example:

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

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

[mirceac@decebal sipxecs]$ 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")
[mirceac@decebal sipxecs]$ 

[mirceac@decebal sipxecs]$ git commit -a
[TEST 747365d] UC-TEST: Patch title
 1 files changed, 1 insertions(+), 1 deletions(-)
[mirceac@decebal sipxecs]$ git status
# On branch TEST
nothing to commit (working directory clean)

...

Generate patches

...

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

that some other developers performed other changes that are commited on the remote branch (origin)

Run the commands from below:

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

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

Example:

Code Block

Falling back to patching base and 3-way merge...
Auto-merging sipXconfig/neoconf/src/org/sipfoundry/sipxconfig/bulk/csv/Index.java
CONFLICT (content): Merge conflict in sipXconfig/neoconf/src/org/sipfoundry/sipxconfig/bulk/csv/Index.java
Auto-merging sipXconfig/neoconf/src/org/sipfoundry/sipxconfig/common/AbstractUser.java
Auto-merging sipXconfig/neoconf/test/org/sipfoundry/sipxconfig/bulk/ldap/UserMapperTest.java
CONFLICT (add/add): Merge conflict in sipXconfig/neoconf/test/org/sipfoundry/sipxconfig/bulk/ldap/UserMapperTest.java
Auto-merging sipXconfig/web/src/org/sipfoundry/sipxconfig/site/admin/ldap/LdapServer.java
Failed to merge in the changes.Patch failed at 0001 XX-6279: Import contact information from LDAP
When you have resolved this problem run "git rebase --continue".If you would prefer to skip this patch, instead run "git rebase --skip".
To restore the original branch and stop rebasing run "git rebase --abort".
[mirceac@decebal sipxecs]$ git add sipXconfig/neoconf/src/org/sipfoundry/sipxconfig/bulk/csv/Index.java
[mirceac@decebal sipxecs]$ git add sipXconfig/neoconf/test/org/sipfoundry/sipxconfig/bulk/ldap/UserMapperTest.java
[mirceac@decebal sipxecs]$ git rebase --continue