PCSX2 Documentation/Git Survival Guide: Difference between revisions
PCSX2 Documentation/Git Survival Guide (view source)
Revision as of 23:13, 8 January 2015
, 8 January 2015→Git use case example
No edit summary |
|||
Line 41: | Line 41: | ||
===Branch management=== | ===Branch management=== | ||
Let's say you want to rebase your current branch topic-v1 to topic-v2 with new addition. Note topic-v1 could also be master too. | Let's say you want to rebase your current branch topic-v1 to topic-v2 with new addition. Note topic-v1 could also be master too. | ||
* Go to current branch: git checkout topic-v1 | * Go to current branch: <code>git checkout topic-v1</code> | ||
* Create a new one: git branch topic-v2 | * Create a new one: <code>git branch topic-v2</code> | ||
* Go into the new branch: git checkout topic-v2 | * Go into the new branch: <code>git checkout topic-v2</code> | ||
* Set the reference: git branch --set-upstream-to=origin/master topic-v2 | * Set the reference: <code>git branch --set-upstream-to=origin/master topic-v2</code> | ||
* Rebase: git rebase -i | * Rebase: <code>git rebase -i</code> | ||
* ... | * ... | ||
===Split commit=== | ===Split commit=== | ||
* copy your repository if you're not confident with this kind of operation: cp -a | * copy your repository if you're not confident with this kind of operation: <code>cp -a <repository><repository backup></code> | ||
* do a rebase: git rebase -i | * do a rebase: <code>git rebase -i</code> | ||
* Use edit on the commit that you want to split | * Use edit on the commit that you want to split | ||
... rebase on-going... | ... rebase on-going... | ||
* Uncommit: git reset --soft HEAD~1 | * Uncommit: <code>git reset --soft HEAD~1</code> | ||
* Unstage: git reset HEAD -- | * Unstage: <code>git reset HEAD --</code> | ||
At this stage of operation, you get all your change in local file but nothings is ready to be | At this stage of operation, you get all your change in local file but nothings is ready to be committed. | ||
Repeate the 2 next commands for each new commits that you want to create | Repeate the 2 next commands for each new commits that you want to create | ||
* staged your change with dynamic selection: git add/rm -p | * staged your change with dynamic selection: <code>git add/rm -p <file></code> | ||
* commit your change: git commit | * commit your change: <code>git commit</code> | ||
Once you have finished to split your commit: | Once you have finished to split your commit: | ||
* finish the rebase: git rebase --continue | * finish the rebase: <code>git rebase --continue</code> |