Jump to: navigation, search

Difference between revisions of "Your first review on Zaqar"

(Branches and Commits)
(Common Problems)
Line 12: Line 12:
 
1. You realized that you were working in master and you HAVEN'T made any commits.
 
1. You realized that you were working in master and you HAVEN'T made any commits.
 
Solution
 
Solution
<pre><nowiki>
+
<pre>
 
git checkout -b newbranch    #if you already created the branch, omit the -b
 
git checkout -b newbranch    #if you already created the branch, omit the -b
 
git commit -a -m "Edited"
 
git commit -a -m "Edited"
</pre></nowiki>  
+
</pre>  
 
Now all your changes are in newbranch. Problem solved!
 
Now all your changes are in newbranch. Problem solved!
  
 
2. You realized that you were working in master and you HAVE made commits to master
 
2. You realized that you were working in master and you HAVE made commits to master
<pre><nowiki>
+
<pre>
 
git branch newbranch
 
git branch newbranch
 
git reset --hard HEAD~x    #x is the number of commits you have made to master. YOU WILL LOSE ANY UNCOMMITTED WORK
 
git reset --hard HEAD~x    #x is the number of commits you have made to master. YOU WILL LOSE ANY UNCOMMITTED WORK
 
git checkout newbranch
 
git checkout newbranch
</pre></nowiki>
+
</pre>
 
Your commits are now in newbranch. Problem solved!
 
Your commits are now in newbranch. Problem solved!
  

Revision as of 15:57, 9 May 2014

Your First Patch

Resources

The Gerrit Workflow page should be your main resource for how to submit a patch. It covers creating the necessary accounts and signing the necessary agreements required for you to submit your patch. It also covers how you should set up your git environment and what your commit messages should look like.

Agreements and Accounts

Branches and Commits

The Gerrit Workflow page contains all you need to know about setting up your repository for Gerrit. Follow the instructions carefully so you don't miss anything.

Common Problems

1. You realized that you were working in master and you HAVEN'T made any commits. Solution

git checkout -b newbranch     #if you already created the branch, omit the -b
git commit -a -m "Edited"

Now all your changes are in newbranch. Problem solved!

2. You realized that you were working in master and you HAVE made commits to master

git branch newbranch
git reset --hard HEAD~x    #x is the number of commits you have made to master. YOU WILL LOSE ANY UNCOMMITTED WORK
git checkout newbranch

Your commits are now in newbranch. Problem solved!

3. You made multiple commits and realized that Gerrit needs one commit per patch You need to squash your previous commits. Make sure you are in your branch and follow [ http://gitready.com/advanced/2009/02/10/squashing-commits-with-rebase.html this] guide. Fill in the commit message as specified on the Gerrit Workflow page

Git Review