B2G/QA/Git Commands: Difference between revisions
Jump to navigation
Jump to search
(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...") |
No edit summary |
||
Line 1: | Line 1: | ||
For a Gaia patch there are several ways that you can handle applying a patch. | For a Gaia patch there are several ways that you can handle applying a patch. | ||
# 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: | |||
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> | ||
* git checkout -b <branch name> | #* ex git checkout -b Bug908513 | ||
* ex git checkout -b Bug908513 | # you can pull the branch locally from a developer's git hub repo via : | ||
#* git pull <their gaia.git repo> <branch name> | |||
#* ex git pull https://github.com/davidflanagan/gaia.git bug989290-v1.3t | |||
* git pull <their gaia.git repo> <branch name> | # to see the branches available locally: | ||
* ex git pull https://github.com/davidflanagan/gaia.git bug989290-v1.3t | #* git branch | ||
# to switch branches: | |||
#* git checkout <branch name> | |||
* git branch | #* ex git checkout master | ||
# to delete a no longer used branch: | |||
#* git branch -D <branch name> | |||
* git checkout <branch name> | #* ex. git branch -D bug_905831 | ||
* ex git checkout master | # adding a remote location: | ||
#* git remote add nhirata nhirata@mozilla.com:nhirata/B2G.git | |||
# to cherry pick a commit, fetch the remote location and branch then cherry pick the commit. Cherry picking: | |||
* git branch -D <branch name> | #* git fetch nhirata bug914179 | ||
* ex. git branch -D bug_905831 | #* git cherry-pick <SHA-COMMIT-ID> | ||
# Squashing commits ( http://davidwalsh.name/squash-commits-git ) | |||
#* git rebase -i master | |||
git remote add nhirata nhirata@mozilla.com:nhirata/B2G.git | #* <squash the other patches other than the head patch> | ||
#* git push -f <repo> <branch> | |||
# To squash four commits into one, do the following: | |||
Cherry picking: | #* $ git rebase -i HEAD~4 | ||
* git fetch nhirata bug914179 | # Revert a patch: | ||
* git cherry-pick <SHA-COMMIT-ID> | #* git revert ad049bb9cc6ba57839649726560955592352023a | ||
git rebase -i master | |||
<squash the other patches other than the head patch> | |||
git push -f <repo> <branch> | |||
$ git rebase -i HEAD~4 | |||
Revert a patch: | |||
git revert ad049bb9cc6ba57839649726560955592352023a |
Revision as of 16:29, 1 August 2014
For a Gaia patch there are several ways that you can handle applying a patch.
- 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
- you can pull the branch locally from a developer's git hub repo via :
- git pull <their gaia.git repo> <branch name>
- ex git pull https://github.com/davidflanagan/gaia.git bug989290-v1.3t
- to see the branches available locally:
- git branch
- to switch branches:
- git checkout <branch name>
- ex git checkout master
- to delete a no longer used branch:
- git branch -D <branch name>
- ex. git branch -D bug_905831
- adding a remote location:
- git remote add nhirata nhirata@mozilla.com:nhirata/B2G.git
- 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>
- 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>
- To squash four commits into one, do the following:
- $ git rebase -i HEAD~4
- Revert a patch:
- git revert ad049bb9cc6ba57839649726560955592352023a