Changes for page Git
Last modified by Richard Kreissig on 2025/01/30 12:03
Summary
-
Page properties (1 modified, 0 added, 0 removed)
-
Objects (1 modified, 0 added, 0 removed)
Details
- Page properties
-
- Content
-
... ... @@ -132,7 +132,7 @@ 132 132 133 133 = Branching and Merging = 134 134 135 -In the previous section you have created two commits on the default branch, which is named {{code language="none"}}master{{/code}}. Now you will create a new branch and commit there, thus adding complexity to the commit graph. In general, you may create as many local branches as you like, since they are simple to use and can be a great tool to structure your work.135 +In the previous section you have created two commits on the default branch, which is named {{code language="none"}}master{{/code}}. Now you will create a new branch and commit there, thus adding complexity to the commit graph. 136 136 137 137 1. ((( 138 138 Create a branch with name //sketches//: ... ... @@ -633,46 +633,8 @@ 633 633 HEAD is now at b58ded7 Merge branch 'master' of git.rtsys.informatik.uni-kiel.de:personal-msp/turing 634 634 {{/noformat}} 635 635 636 -This resets //all// changes to the working copy to the head of the current branch, so use it with caution! However, {{code language="none"}}reset{{/code}} does not remove unstaged files. In order to do that in one command, use {{code language="none"}}clean{{/code}}:636 +This resets //all// changes to the working copy to the head of the current branch, so use it with caution! 637 637 638 -{{noformat}} 639 -$ git status 640 -# On branch master 641 -# Untracked files: 642 -# (use "git add <file>..." to include in what will be committed) 643 -# 644 -# test1.tmp 645 -# test2.tmp 646 -nothing added to commit but untracked files present (use "git add" to track) 647 -$ git clean -f 648 -Removing test1.tmp 649 -Removing test2.tmp 650 -{{/noformat}} 651 - 652 652 === Rebasing === 653 653 654 -Consider the following situation: 655 - 656 -[[image:attach:turing-graph-03.png]] 657 - 658 -If you want to merge the changes made on the {{code language="none"}}master{{/code}} branch into the {{code language="none"}}sketches{{/code}} branch, the normal way is to use the {{code language="none"}}merge{{/code}} command and create a merge commit. However, the {{code language="none"}}rebase{{/code}} command gives an interesting alternative to that: it reapplies all commits done in the current branch starting from a given reference. 659 - 660 -{{noformat}} 661 -$ git rebase master 662 -First, rewinding head to replay your work on top of it... 663 -Applying: added another example 664 -Applying: state transitions 665 -Using index info to reconstruct a base tree... 666 -Falling back to patching base and 3-way merge... 667 -Auto-merging notes.txt 668 -{{/noformat}} 669 - 670 -Afterwards the commit graph looks like this: 671 - 672 -[[image:attach:turing-graph-04.png]] 673 - 674 -The two commits made in {{code language="none"}}sketches{{/code}} are reapplied starting from the head of the {{code language="none"}}master{{/code}} branch. The resulting structure of commits is much cleaner than before. It is even possible to squeeze multiple commits into one using {{code language="none"}}rebase{{/code}}. Note that in this example a merge conflict had to be resolved in the same way as it was done in Section "Branching and Merging"; instead of committing the resolved file, the rebase command is resumed with {{code language="none"}}git rebase --continue{{/code}}. 675 - 676 -{{warning}} 677 -Never rebase a branch that is already pushed online! Due to the structural change the rebased branch is no longer compatible with the previous one, and pushing it will fail, since fast-forward merge is not possible. 678 -{{/warning}} 640 +
- Confluence.Code.ConfluencePageClass[0]
-
- Id
-
... ... @@ -1,1 +1,1 @@ 1 -298216 81 +2982165 - URL
-
... ... @@ -1,1 +1,1 @@ 1 -https://rtsys.informatik.uni-kiel.de/confluence//wiki/spaces/WS12EclPract/pages/298216 8/Git1 +https://rtsys.informatik.uni-kiel.de/confluence//wiki/spaces/WS12EclPract/pages/2982165/Git