Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The best approach really depends on whether other people have remote copies of your code. If the <em>master</em> branch is only on your local machine, you can use the rebase command to interactively apply the commits from the feature branch into master:</p> <pre><code>git checkout master -b iphone-merge-branch git rebase -i iphone </code></pre> <p>Note that this alters the commit history of your new <em>iphone-merge-branch</em> branch, which may cause problems for anyone else trying to pull your changes into their checkout later on. By contrast, the merge command applies the changes as a new commit, which is safer when collaborating because it doesn't affect the branch history. See <a href="http://www.gitready.com/intermediate/2009/01/31/intro-to-rebase.html" rel="noreferrer">this article</a> for some useful tips on using rebase.</p> <p>If you need to keep your commit history in sync, you are better off performing a merge. You can use <em>git mergetool</em> to interactively fix conflicts one-by-one using a visual diff tool (a tutorial on this can be <a href="http://gitguru.com/2009/02/22/integrating-git-with-a-visual-merge-tool/" rel="noreferrer">found here</a>):</p> <pre><code>git checkout master -b iphone-merge-branch git merge iphone git mergetool -t kdiff3 </code></pre> <p>A third option, if you want absolute control over the process, would be to use <em>git cherry-pick</em>. You can use gitk (or your favourite history viewer) to view the commit hashes in the iphone branch, note them down, and cherry pick them individually into the merging branch - fixing conflicts as you go. An explanation of this process can be <a href="http://www.gitready.com/intermediate/2009/03/04/pick-out-individual-commits.html" rel="noreferrer">found here</a>. This process will be the slowest, but might be the best fall-back option if the other methods do not work out:</p> <pre><code>gitk iphone &lt;note down the 35 commit SHA hashes in this branch&gt; git checkout master -b iphone-merge-branch git cherry-pick b50788b git cherry-pick g614590 ... </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload