The tutorials may take significantly longer, but You presumably will not get through
the tutorial in less than the indicated times.
You can go back to the starting condition the_tutorial_merge1, the_tutorial_merge2,
... parts by running git_tutorial2.sh with the argument --tutorial ...part..._start
e.g.
When executing the command without any argument You will get the the list of tutorial
parts and some basic instructions:
shgit_tutorial2.sh--tutorial
Notes:
If You want to do the sparse checkout tutorial part, You should start with that
since it has an impact on the other tutorial parts The sparse checkout does not
depend on a particular initial state and You cannot reset the starting state for
this tutorial part. Just read the instructions. In case You want to redo this part
from scratch there is only "--wipe-clean" (see below).
The tutorial parts merge I+II and rebase I+II have a lot of overlap, nevertheless it
is instructive to do both. You could short-cut one or the other occasionally by
making use of the provided "solutions", but it makes sense to try to resolve the
conflicts by Yourself.
The part compare_history assumes that the merge and rebase parts have been
completed, and just is about comparing the two approaches.
The squash commits and interactive rebase tutorial assumes that the merge I+II part
have been completed.
The worktree part will use sparse checkouts. But it is not a problem if You skipped
the sparse checkout part.
You can restore the starting condition for a certain tutorial part by issuing the
command
sh ...path-to-script.../git_tutorial2.sh --tutorial the_tutorial_....._start
If You do the tutorial in order, and do a part for the first time, then the starting
condition should be in the correct state i.e. You only have to restore the starting
condition if You do the tutorial parts in a different order or if You want to retry
a tutorial part.
If You messed up You can recreate the mock-up repository by executing
sh ...path-to-script.../git_tutorial2 --wipe-clean
But that will remove Your personal work on this repository. You can still restore the
prepared starting conditions for the various tutorial parts as described above.
Use sparse checkout to only checkout a fraction of the full source tree of the
repository,
Test atlas extension for sparse checkouts.
Tasks:
Activate sparse checkout in git.
Use atlas git extension to add "WorkDir", "Pkg1", "Base" and "Alg" to the sparse
checkout.
Detailed description:
Some people like sparse checkouts because it limits the number of files in the working
directory to those which are relevant for the current task. This also reduces the amount
of disk space of a checkout, and depending on the disk or file system this may also
speedup operations. Other people rather want to see always all files and prefer a full
checkout. The latter simplifies some operations like investigating files which would not
be part of a sparse checkout, and some tools or IDEs may not properly handle sparse
checkouts.
Activate sparse checkout in git (disable "cone" pattern matching for filtering the
sparse checkout because git-atlas does not handle these patterns)
1
gitsparse-checkoutinit--no-cone
Use atlas extension to add packages to the sparse checkout
This file can be edited manually but git atlas addpkg ... or git atlas rmpkg ...
are more convenient. The directories in the sparse checkout can also be listed with
6
gitsparse-checkoutlist
The git sparse-checkout can also be used to manipulate the sparse checkout (see
"git sparse-checkout --help" for the full list of options)
Finally checkout everything that is listed in the sparse checkout for the branch
(fix-sphere-integration-test) (should already be done)
Update Your development branch to a more recent upstream release using merge.
Resolve merge conflicts
Tasks:
Create a new branch fix-sphere-integration-test_merge for the tutorial parts merge1,
and merge2 (later in the tutorial these specific branches are used to compare merge
and rebase).
Conserve current state in a new branch tmp_beforeMerge_2025-01-12T2101
merge in changes from nightly/main/2025-01-12T2101, and resolve merge conflicts.
"the" solution can be found in solution/merge1
Detailed explanation and help:
Situation: You developed a new feature in Your feature branch
"fix-sphere-integration-test". After a long break You come back to work and want to
continue Your development. You first will update Your branch to the most recent
version. Typically that would be "nightly/main/...date string...." matching the (latest)
nightly You have setup. You could also update to the "main" branch of the ATLAS athena
repository, but that would not necessarily compile together with the nightly You have
locally setup. There might be a situation in which You have to update to the "main"
branch that, but that also means that You cannot easily compile locally and test Your
changes.
One possibility to do the update is to merge the nightly branch into Your feature
branch. That is what You should do in this tutorial part.
To simplify getting back to the state before a merge, it makes sense to create a branch
which conserves the current state i.e. the state before merging, which You can delete
later (e.g. create a branch tmp_beforeMerge_2025-01-12T2101). There are other
possibilities to recover an old state. But this makes Your life easier in case You want
to verify that nothing got lost after merging or because You screwed up and want to redo
the merge. After that, merge in the changes from the latest nightly
i.e. nightly/main/2025-01-12T2101. After the merge Your branch should look like
solution/merge1 If You do not know what to do You find detailed instructions below.
To restore the initial condition for this tutorial part execute
(not necessary if You do the tutorial in order and do this part for the first time)
In later tutorial parts we want to compare two approaches to update the working
branch. Therefore the merge tutorial should be executed in its separate branch
fix-sphere-integration-test_merge:
First memorise the current state in a new branch in case something goes wrong. There
are other possibilities but branches are cheap and this is convenient:
15
gitbranchtmp_beforeMerge_2025-01-12T2101
Then merge in the changes from the branch with the most recent version:
16
gitmergenightly/main/2025-01-12T2101
In this tutorial the merge will not succeed but produce conflicts which need to be
resolved. You should see messages like "CONFLICT (content): Merge conflict in ... " and
"git status" should show "both modified: ... " .
resolve conflicts:
edit all the files which have conflicts.
in this example there should be conflicts in "Test/Pkg2/Pkg2/Cube.h" and
"Test/Alg/Alg/Integrator.h"
"git merge" should tell, or "git status" should also remind You.
In the files there are markers which indicate the text blocks with conflicts:
start: "<<<<<<<"
mid: "======="
end: ">>>>>>>"
The part between "<<<<<<" and "=======" should be Your version prior to the merge
The part between "=======" and ">>>>>>>" should be the version of the branch being
merged in. The final version should likely be a combination of the two edits. The
solution is not necessarily trivial.
A conflict resolution has been prepared in a specific branch which can be used as a
reference for comparisons or to actually resolve the merge conflicts.
There can also be merge conflicts in files which are not part of the sparse
checkout if You use sparse checkouts e.g. in case You committed changes to git in
packages which You have removed from the sparse checkout later on, or the
merge-source and Your tree already deviated prior to Your edits. In this case there
are conflicts in Pkg2 which is not part of the sparse checkout if You did the
sparse_checkout tutorial part.
If You do not know what to do, since You do not remember much about the changes gather
some information. Let us start with the conflict in Cube.h. You could look at the
commits which effect the file:
17
gitlog--Test/Pkg2/Pkg2/Cube.h
Your edits: change from float to double
You can look at the changes of the commits. In this case it is the top most commit, so
You can just look at the diff HEAD^..HEAD
18
gitdiffHEAD^..HEAD--Test/Pkg2/Pkg2/Cube.h
Then You would look for relevant changes in the other branch:
merged in changes: compiler warning fix concerning unused variables
In this case the commit is the second top most of all commits in
"nightly/main/2025-01-12T2101". To look at the changes You can look at the diff using
either the hash or the relative reference
"nightly/main/2025-01-12T2101~2..nightly/main/2025-01-12T2101~1":
(optional) create a check point to get back to the situation after tutorial merge1.
This allows to restore this state as the starting condition for the
tutorial part merge2.
30
gittagtutorial/merge1_end
The next tutorial part would be the_tutorial_merge2_start
Update Your development branch to an even more recent upstream release using merge.
Resolve merge conflicts
Preparation to compare with the alternative approach, rebase, which is part of the
next tutorial
Tasks:
Perform some "developments" by cherry-picking "edit-follow-naming-convention".
Before merging conserve the current state in tmp_beforeMerge_${AtlasBuildStamp}.
Merge in changes from the nightly You have setup "nightly/main/${AtlasBuildStamp}"
Compare with the prepared solution
Detailed explanation:
You continue developing Your feature, which takes a couple of days. Before the merge
request You want to update Your branch to at least the latest nightly which You have
setup already. To have an easy possibility to restore the situation before the merge
You create a branch tmp_beforeMerge_${AtlasBuildStamp}, which You will delete later
on. Then You use merge to update Your feature branch to "nightly/main/${AtlasBuildStamp}"
To restore the initial condition for this tutorial part execute
(not necessary if You do the tutorial in order and do this part for the first time)
Use rebase instead of merge to include changes from the main branch.
Very similar to merge1 but instructive to try both, merge and rebase.
Tasks:
To compare the merge and rebase approach, do the rebase tutorial parts in a new branch
fix-sphere-integration-test_rebase.
Conserve the current state in a new branch tmp_beforeRebase_2025-01-12T2101, which You
can delete later.
Rebase Your work branch on the latest version nightly/main/2025-01-12T2101.
"The" solution can be found in solution/rebase1
Detailed explanation:
To incorporate changes from other branches into Your working branch there is the possibility
to merge in changes, which You did in merge1 and merge2, and there is the possibility to
"rebase" Your changes on a new base version, which this tutorial is about. Rebase will add all
Your changes on-top of that version one-by-one. To compare later on the merge and rebase
approach, do the rebase tutorial in a new branch fix-sphere-integration-test_rebase.
To facilitate verification that no changes got lost, or to return to the state before the rebase,
conserve Your working branch in a temporary branch tmp_beforeRebase_2025-01-12T2101. Then use
rebase to get the changes from nightly/main/2025-01-12T2101. In case of conflicts resolve the
conflicts and compare with the prepared solutions. Since rebase will apply Your commits one
after the other on a new base version each commit may have its own conflicts.
To restore the initial condition for this tutorial part execute
(not necessary if You do the tutorial in order and do this part for the first time)
Keep current state in case something goes wrong or for verification
46
gitbranchtmp_beforeRebase_2025-01-12T2101
Rebase Your branch on a "more recent nightly"
47
gitrebasenightly/main/2025-01-12T2101
Resolve 1st conflict. When using rebase Your edits are put on top of the new base version
and the edits which produce conflicts are not yet committed. Thus the commit history of
the current branch does not tell You anything about the intend of the edits. Only the
error message of the rebase does, and the conflict marker comments in the files with
conflicts.The conserved version in tmp_beforeRebase_2025-01-12T2101 might be helpful.
... edit files with conflicts ...
(Optionally) compare with the provided solution
the solution can be found in solution/rebase1_remove_output
In case something goes seriously wrong, there is "git rebase --abort" which will
bring You back to the state before the rebase. But all Your work after starting
the rebase will be discarded.
Resolve 2nd conflict
... edit files with conflicts ...
(Optionally) compare with the provided solution
the solution can be found in merge/fix-sphere-integration-test/2025-01-12T2101
like the previous tutorial rebase1, and similar to the second merge tutorial.
Tasks:
Simulate some edits by cherry picking edit-follow-naming-convention.
Before the rebase conserve the current state in tmp_beforeRebase_${AtlasBuildStamp}.
Update Your working branch by rebasing on the most recent nightly
nightly/main/${AtlasBuildStamp}.
Compare with the prepared solution solution/rebase2.
Detailed explanation:
This is the same as merge2 but using rebase instead and very similar to rebase1.
You continue working on Your feature, which is simulated by cherry-picking
edit-follow-naming-convention. Before updating to the latest nightly You
conserve the current state in a new branch tmp_beforeRebase_${AtlasBuildStamp},
which You can delete later. Then You rebase on "nightly/main/${AtlasBuildStamp}".
Finally compare with the solution solution/rebase2.
To restore the initial condition for this tutorial part execute
(not necessary if You do the tutorial in order and do this part for the first time)
Understand the different histories created by merge and rebase
Tasks:
After executing merge1, merge2, rebase1, and rebase2, compare the histories
resulting from the two approaches
Detailed explanation:
Look at the history resulting from merge and rebase. For this we look at the log,
including the history graph drawing and decorations with tags and branch names.
To restore the initial condition for this tutorial part execute
(not necessary if You do the tutorial in order and do this part for the first time)
Look at the history resulting from the merge and rebase tutorial, annotate the
commits with the tag and branch names and also show the relation between the nodes:
You should see that rebase creates a much simpler history than merge. All Your
(simulated edits) would be one after the other, rather than interleaved with commits
from the merges. Thus, if You want to keep the commits as separate commits for
e.g. creating multiple dependent merge requests, rather use rebase. If You will
"squash" the commits anyway (see next tutorial part), merge may produce fewer merge
conflicts.
The next tutorial part would be the_tutorial_squash_commits_start
Squash all commits of a feature branch into a single commit¶
About:
Sometimes the local history of a new feature becomes complicated, but for the
outside world the history is of no interest. In such cases the commit history
could be squashed into a single commit e.g. for a merge request.
Tasks:
Create a branch "squash-test-feature" from "tutorial/merge2_end"
Inspect the history, and understand which commits belong to Your developments.
Create a new branch "squash-test-final" from "nightly/main/${AtlasBuildStamp}"
Merge "squash-test-feature" into "into squash-test-final" with the "--squash"
option.
Compare "squash-test-final" and "squash-test-feature" to ensure that
nothing got lost.
Detailed description
For the tutorial create the branch "squash-test-feature" based on
"tutorial/merge2_end"
Development was started using the base "fix-sphere-integration-test-base"
After some development which happened immediately after, and which can be seen
in fix-sphere-integration-test-dev, You updated to
"nightly/main/2025-01-12T2101", applied one additional fix "Follow naming
convention", and finally to prepare for a merge request You updated to
"nightly/main/${AtlasBuildStamp}" (tutorial parts merge1 + merge2).
The commit history got complicated and for the merge request You want to squash
all commits into a single one using the squash feature of merge.
For this, You create a new branch "squash-test-final" which is based on the most
recent version You updated Your developments to, which is
"nightly/main/${AtlasBuildStamp}".
Finally You merge Your development branch "squash-test-feature" into
"squash-test-final" with the "--squash" option, and verify that nothing got
lost.
To restore the initial condition for this tutorial part execute
(not necessary if You do the tutorial in order and do this part for the first time)
The state before You started development is in "fix-sphere-integration-test-base",
most of the development is in fix-sphere-integration-test-dev, And then You applied
one final fix "Follow naming convention"
Checkout a new branch which will be used for the merge request
it should be based on the most recent version You updated Your
development branch to with either merge or rebase.
This will only stage all changes. The commit still needs to be made:
78
gitcommit
Write a commit message which comprises the developments of all the commits that
got squashed into this single one.
Finally check that nothing was lost
79
gitdiffsquash-test-feature
and lock at the new history
80
gitlog--format=oneline--decorate--graph
which should now look like "nightly/main/${AtlasBuildStamp}" but with the one extra
commit You just have created.
The next tutorial part would be the_tutorial_interactive_rebase_start
Interactive rebase to cleanup the commit history (optional)¶
About:
Use an interactive rebase to clean up the commit history: fix commit
messages, fix changes, squash commits.
Tasks:
Create a new branch "interactive-rebase" for the interactive rebase tutorial
based on fix-sphere-integration-test_rebase
Create a temporary branch tmp_beforeInteractiveRebase to conserve the current
state (for verification or recovery).
Start the interactive rebase from commit "interactive-rebase-first-commit".
Fix a typo in the include guard in Test/Pkg1/Pkg1/Sphere.h, which was added
in commit "Add sphere".
Fix the commit message of commit "Increase precision". Change the message to
"Increase precision of integration."
Squash the commits "Follow naming convention" and "Underflow protection",
because "Follow naming convention" is just a fix of the commit
"Underflow protection" and in the cleaned history You do not want to have
commits which require fixes.
Detailed description:
To restore the initial condition for this tutorial part execute
(not necessary if You do the tutorial in order and do this part for the first time)
Create a temporary branch You can delete later to conserve the current state
for later verification or recovery
83
gitbranchtmp_beforeInteractiveRebase
Now use the interactive rebase "rebase -i" to improve the commit history. In this
tutorial You only marginally improve the commit history, but it should give You some
ideas how the interactive rebase can be used. The starting commit would be
"interactive-rebase-first-commit", which is a couple of commits earlier than Your
current head. To alter the commit history starting from (but not including) this
commit, execute:
84
gitrebase-iinteractive-rebase-first-commit
This will open an editor which contains a compact version of the commit history and
some instructions. You can re-order the individual commits or request certain actions
on the commits, like "pick", "drop", "edit", "squash". "pick" would just use the
commit unmodified. "drop" would remove a commit. "edit" will pause the rebase and
allow for all kinds of actions: use "git commit --amend" to modify a commit; add
extra commits, or revert commits. Such changes may cause "merge" conflicts once the
rebase is resumed. So, such changes may cause extra work. If the interactive rebase
is started it will pause according to Your markings, to allow You to apply some
modifications. Once You are happy with the changes to the commit (or the addition of
commits or reverts), resumed the interactive rebase with "git rebase --continue". If
You screwed up You can use "git rebase --abort", which will restore the state just
before the rebase and discard all changes of this interactive rebase.
a) Your first task is to fix a typo in the commit "Add sphere". Find the commit in
the editor and mark the commit for editing by replacing "pick" by "edit".
b) The second task is to fix the commit message of commit "Increase precision". So,
mark the corresponding line for editing as well.
c) The final task is to squash the two commits "Follow naming convention",
"Underflow protection". The action "squash" will squash a commit with the commit
above, so You have to put the commits in the correct order. In this case You have to
place "Follow naming convention" directly under "Underflow protection". Then mark
the commit "Follow naming convention" for squashing by replacing "pick" with "squash".
Once, all the modifications You want to perform are marked in this steering file,
save the file and exit the editor. This will start the interactive rebase. The
interactive rebase will start from the first commit
i.e. interactive-rebase-first-commit in this case, then play out the actions. The
interactive rebase will pause on lines marked "edit", "squash" or in case there are
merge conflicts which may happen if You edit files, add commits or You changed the
order of commits in the steering file. When the rebase pauses perform the desired or
necessary edits, or add extra commits, reverts, cherry-picks etc. , and resume the
rebase with "git rebase --continue", or use "git rebase --abort" and retry the
interactive rebase from the beginning
In this example the interactive rebase will pause after applying "Add sphere."
because You marked this commit for editing. You should now edit
"Test/Pkg1/Pkg1/Sphere.h", and replace "PKG1_SPHER_H" with "PKG1_SPHERE_H".
Check Your changes, stage them, rewrite the commit (the commit message is fine, so
no editing of the message needed) with
After that, the rebase will pause once the commit "Increase precision" is applied,
because You also marked this commit for editing. Now, just modify the commit message
and change it to "Increase precision of integration." and e.g. look at the
(truncated) history:
8990
gitcommit--amend-m"Increase precision of integration."
gitlog-n2
or use the editor by omitting -m "..." (recommended, but here the message is short
and simple). Then resume the rebase
91
gitrebase--continue
The rebase will pause again when squashing the commit "Follow naming convention" with
"Underflow protection". Unfortunately it will produce a merge conflict. Git will tell
You about the commit which causes the problem. So, You should have the information at
hand to inspect the intention of the conflicting commit and solve the conflict. The
conflict is in "Test/Pkg1/Pkg1/Sphere.h".
Here instead of actually solving the merge conflict, we just start from the version before the
conflict and redo the edits the conflicting commit was about. In general this strategy will not
work well, but in this case the conflicting commit is simple.
First, the version before the conflict is checked out.
92
gitcheckout-fHEAD--Test/Pkg1/Pkg1/Sphere.h
And then just redo the intended edits: replace save_sqrt by saveSqrt in
Test/Pkg1/Pkg1/Sphere.h.
Check the changes:
93
gitdiff--Test/Pkg1/Pkg1/Sphere.h
Note: if You just would have used the second of the two options which show up in
"Test/Pkg1/Pkg1/Sphere.h" to solve the conflict, You would already incorporate
changes of a later commit, which You "want" to keep separate in this tutorial. If
You are satisfied with the changes, stage them
94
gitaddTest/Pkg1/Pkg1/Sphere.h
Check that You have not missed other conflicts and just resume the rebase
95
gitstatus
96
gitrebase--continue
When squashing commits the interactive rebase will offer to change the commit
message. The editor will contain the commit messages of all commits that are being
squashed. In most cases some editing is necessary. Write the full commit message for
the squashed commits. In this case the second commit only corrects the first one and
the message of the second commit can just be removed. Save the message, exit the
editor, and the rebase will resume automatically.
Unfortunately the edits will lead to another conflict, which needs to be resolved.
Since the changes are again simple one can use the same strategy and just checkout
the version prior to the conflict and apply the changes of the conflicting commit
manually which is just the change from float to double (look at the changes
introduced by the conflicting commit). And again, this strategy works here, but in
general may not be so useful.
97
gitcheckout-fHEAD--Test/Pkg1/Pkg1/Sphere.h
Manually apply the changes, Check, and if You are satisfied stage them. Then verify
that no conflicts remain and resume the rebase
The rest works fine. Finally we check that there are no unintended differences and
compare with the version prior to the rebase:
102
gitdifftmp_beforeInteractiveRebase
You applied one fix to a typo, so You should see this difference wrt. the version
before the rebase. The full solution should look like the version in
solution/interactive-rebase-unclean-history
but the history is not cleaned there. Also check the commit history that it looks as
intended. (Optionally) finally tag Your solution for future investigations.
104
gittagtutorial/interactive_rebase_end
The next tutorial part would be the_tutorial_worktree_start
Work simultaneously on a feature development and some maintenance in different
directories but with only one local repository clone using worktrees.
Use sparse checkouts to limit the checked out files to the relevant ones.
Tasks:
FEATURE: create directories to develop the feature
"${top}/WT/FixIntegrationTest/source/", "${top}/WT/FixIntegrationTest/build", where
"${top}" refers to the top level directory in which You created the mock-up directory.
FEATURE: re-enter the mock-up repository (Main/source/test/)
FEATURE: create a worktree where the source code should be in
"${top}/WT/FixIntegrationTest/source/athena-fix-integration-test" and the feature
should be developed in the branch "wt-fix-integration-test" based on
"worktree-test-start", suppress the checkout and setup a sparse checkout containing
"WorkDir", "Pkg1", "Base", "Alg".
FEATURE: simulate some developments by cherry-picking a couple of commits
"worktree-test-start..solution~3"
MAIN: switch to a new worktree to do some maintenance on main, which shall happen in
the directories: "${top}/WT/MaintenanceMain/source/",
"${top}/WT/MaintenanceMain/build" in a new worktree "wt-maintenance-main" also based
on "worktree-test-start". Use a sparse checkout of "WorkDir", "Pkg1", "Pkg2", "Base",
"Alg".
MAIN: simulate the development by cherry picking "main~2" and "main~1"
FEATURE: switch back to the feature worktree to continue the development, which is
identical to the rebase1 tutorial.
MAIN: before starting rebase2, switch back to MAIN and finish the development which is
simulated by cherry-picking "main".
FEATURE: after that finish the feature development (identical to rebase2)
Detailed description:
To restore the initial condition for this tutorial part execute
(not necessary if You do the tutorial in order and do this part for the first time)
Go to the top level directory in which You created the mock-up repository. That should be
the directory which contains the "Main" folder. The variable "top" is likely not defined
in Your shell, so You have to adjust the command
106
cd${top}
FEATURE: Create directories for the "feature" development (adjust the command}
FEATURE: Now go back to the directory which contains the git repository:
109
cd${top}/Main/source/test/
FEATURE: Now create a new git worktree
- which starts in a new branch "wt-fix-integration-test",
- the working directory should be e.g.
"../../../WT/FixIntegrationTest/FixIntegrationTest/source/athena-fix-integration-test".
The directory which will contain the source code cannot be named "athena" because this
name is used as a unique identifier for the git worktree. So, it must be a unique name.
- The source branch should be based on "worktree-test-start"
- We use a sparse checkout to not checkout all files (60k files in case of athena).
So, when creating the worktree the checkout is suppressed.
All the branches tags etc. will be in the repository in
"...top level../Main/source/test/". The worktrees are just directories into which
different branches are checked out (note: You cannot use the same branch in multiple
worktrees at the same time). The advantages of worktrees are: reduced disk space usage;
all branches, tags, remotes are visible in every worktree. A disadvantage might be that
Your local repository gets more cluttered with development branches etc. .
FEATURE: Now You would work on the this new feature in the worktree, so enter the
directory
FEATURE: Since the checkout was suppressed the directory should be mostly empty. Now
activate and setup the sparse checkout (disable "cone" pattern matching
for git-atlas)
112
gitsparse-checkoutinit--no-cone
FEATURE: and add the desired packages e.g. using the atlas extension (or
"git sparse-checkout set Projects/WorkDir/ Test/{Pkg1,Base,Alg}/")
FEATURE: The sparse checkout file should now contain
Projects/WorkDir/
Test/Pkg1/
Test/Base/
Test/Alg/
117
gitsparse-checkoutlist
FEATURE: Check out the files part of the sparse checkout (should already be done).
118
gitcheckout-f
FEATURE: Simulate some developments by cherry picking a few commits
119
gitcherry-pickworktree-test-start..solution~3
MAIN: Suddenly, You are tasked to fix some problems in main. So, You have to interrupt
Your current work on "wt-fix-integration-test". The work may require a different
athena release (in this tutorial the same athena release is used). To avoid
having to clone the athena repository again, You can just create a new worktree. Go
to the top level of this tutorial which should be cd ../../../../ and create the
new working directory "WT/MaintenanceMain/"
MAIN: now again go to the main repository and create a worktree
122
cd${top}/Main/source/test/
MAIN: the development should happen in the working directory
"..toplevel.../MaintenanceMain/source/athena-maintenance-main" (remember to use
a unique directory name at the lowest level) and in the branch
"wt-maintenance-main". In this tutorial the source branch is again
"worktree-test-start". Remember to add "--no-checkout" if You want to use a
sparse checkout (otherwise for athena this will check out 60k files)
MAIN: All files of these packages should already be checked out, otherwise:
133
gitcheckout-f
MAIN: To simulate some edits on Your side
134135
gitcherry-pickmain~2
gitcherry-pickmain~1
MAIN: You can compile if You want (one test will fail because the test is going to be
fixed in "wt-fix-integration-test"; not relevant for this tutorial):
FEATURE: While cmake is running You could continue Your development (in e.g. a different
shell; or wait for the compilation to finish). Move back to the directory
in which You are developing the new feature:
FEATURE: Now You fix the integration test as You did in the rebase (I+II) tutorial. You
can use the provided solutions rather than fixing the conflicts Yourself).
This just demonstrates how to use sparse checkouts and worktrees in conjunction with the
full athena repository otherwise it is a simpler version of the worktree tutorial.
If You do not have a local clone of Your athena repository fork create one in
e.g. athena-example-Main/source
To avoid checking out all 60k files prior to setting up the sparse checkout
pass the argument --no-checkout (if the repository is exclusively used in
with worktrees, You can also just clone a "bare" repository without a checkout
area).
Create source and build directories for Your new work area and a directory for the
worktree. Make sure that the lowest level directory which is used as the worktree has a
unique name (athena is not).
The worktree will inherit the sparse checkout config flag, but the sparse checkout
needs to be initialized for the work tree. Check that sparse checkout is active:
179
gitconfigcore.sparsecheckout
Initialise the sparse checkout
180
gitsparse-checkoutinit
Now use the atlas extension to add the "WorkDir", which is needed for building, and the
packages You need to work which is in this tutorial AthExHive
181182
gitatlasaddpkgWorkDir
gitatlasaddpkgAthExHive
The packages should already be checked out, if not
183
gitcheckout-f
implement Your changes and build the packages in Your sparse checkout