Jump to content

Fundraising/tech/git

From Wikitech

Fundraising and Git

As of April 2012, fundraising is using both Subversion and Git to manage repositories.

Working with Git

You will want to have a look at the Mediawiki [[mw:Git/Workflow|Git Workflow] to understand how to use git and [[mw:Gerrit Gerrit]

DonationInterface] is under git.

Checking out branches

One of the strengths of git is best shown in branching.

In the following example, you will see how to create a branch to work on Fundraising 2012 Mingle ticket #2

This examples assumes you have already set up git review. If you have not done so, please see Git Workflow.

cd extensions/DonationInterface

Make sure you are up to date and create a branch based on the Mingle ticket

git pull origin master

git checkout -b mingle-fr-2012-2 master

You can check to see which branches are available and which branch you are currently using with the command:

git branch -a

You should see something like:

  list
  master
* mingle-fr-2012-2
  show
  remotes/origin/HEAD -> origin/master
  remotes/origin/deploy-payments_1.17
  remotes/origin/master

This shows that we are using the branch we just created for the Mingle ticket.

If you are creating a branch to address a Bugzilla ticket, create a branch in this format:

git checkout -b bug25090 master

Check your status to see what you need to commit

git status

Preparing your commit

Add the file to the commit.

git add some_file_you_edited

Commit your code

See [[mw:Git/Workflow#Make and commit your change|make and commit your change]

git commit

If you have files that you do not want to commit, you can hide them with:

git stash

Check your status:

git status

Untracked files will stay put.

You can then see what has been stashed:

git stash list
stash@{0}: WIP on mingle-fr-2012-140: 5b11178 Adding Selenium IDE test for supplemental_address.

Rebase your branch

You can now rebase with master to push your commit to review:

git pull origin master
git rebase master

Run review

git review