B2G/QA/Git Commands

From MozillaWiki
< B2G‎ | QA
Revision as of 16:26, 1 August 2014 by Nhirata (talk | contribs) (Created page with "For a Gaia patch there are several ways that you can handle applying a patch. 1) Creating a new branch I recommend that you create a branch locally first for the changes that...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

For a Gaia patch there are several ways that you can handle applying a patch.

1) Creating a new branch I recommend that you create a branch locally first for the changes that you are about to make. You can do this by:

  • git checkout -b <branch name>
  • ex git checkout -b Bug908513

2) you can pull the branch locally from a developer's git hub repo via :

3) to see the branches available locally:

  • git branch

4) to switch branches:

  • git checkout <branch name>
  • ex git checkout master

5) to delete a no longer used branch:

  • git branch -D <branch name>
  • ex. git branch -D bug_905831

6) adding a remote location: git remote add nhirata nhirata@mozilla.com:nhirata/B2G.git

7) to cherry pick a commit, fetch the remote location and branch then cherry pick the commit. Cherry picking:

  • git fetch nhirata bug914179
  • git cherry-pick <SHA-COMMIT-ID>

8) Squashing commits ( http://davidwalsh.name/squash-commits-git ) git rebase -i master <squash the other patches other than the head patch> git push -f <repo> <branch>

9) To squash four commits into one, do the following: $ git rebase -i HEAD~4

10) Revert: Revert a patch: git revert ad049bb9cc6ba57839649726560955592352023a