https://hpc-wiki.info/hpc/index.php?title=Git&feed=atom&action=historyGit - Revision history2024-03-29T13:01:10ZRevision history for this page on the wikiMediaWiki 1.35.9https://hpc-wiki.info/hpc/index.php?title=Git&diff=4953&oldid=prevKamil-braschke-0d3e@uni-wuppertal.de: /* Basic Usage */2022-10-05T05:35:15Z<p><span dir="auto"><span class="autocomment">Basic Usage</span></span></p>
<table class="diff diff-contentalign-left diff-editfont-monospace" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="en">
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Older revision</td>
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 05:35, 5 October 2022</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l58" >Line 58:</td>
<td colspan="2" class="diff-lineno">Line 58:</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>If everything is correct, you can commit your changes and add a description of your changes.</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>If everything is correct, you can commit your changes and add a description of your changes.</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div><syntaxhighlight lang="bash"></div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div><syntaxhighlight lang="bash"></div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>user@cluster.rz.rwth-aachen.de: $ git commit -m "<del class="diffchange diffchange-inline">I changed </del>everything."</div></td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>user@cluster.rz.rwth-aachen.de: $ git commit -m "<ins class="diffchange diffchange-inline">Change </ins>everything."</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div></syntaxhighlight></div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div></syntaxhighlight></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
</table>Kamil-braschke-0d3e@uni-wuppertal.dehttps://hpc-wiki.info/hpc/index.php?title=Git&diff=4947&oldid=prevMarc-andre-hermanns-bc32@rwth-aachen.de: Changing section title from "stuff" to "topics"2022-09-23T09:50:51Z<p>Changing section title from "stuff" to "topics"</p>
<table class="diff diff-contentalign-left diff-editfont-monospace" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="en">
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Older revision</td>
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 09:50, 23 September 2022</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l66" >Line 66:</td>
<td colspan="2" class="diff-lineno">Line 66:</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div></syntaxhighlight></div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div></syntaxhighlight></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>== Advanced <del class="diffchange diffchange-inline">Stuff </del>==</div></td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>== Advanced <ins class="diffchange diffchange-inline">Topics </ins>==</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>If you and another contributor have worked on the same files and git cannot automatically resolve these conflicts, the merge conflicts have to be resolved manually.</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>If you and another contributor have worked on the same files and git cannot automatically resolve these conflicts, the merge conflicts have to be resolved manually.</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>A good tutorial on how to merge your changes can be found in the GitHub Documentation: [https://help.github.com/articles/resolving-a-merge-conflict-using-the-command-line/ Resolving a merge conflict using the command line].</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>A good tutorial on how to merge your changes can be found in the GitHub Documentation: [https://help.github.com/articles/resolving-a-merge-conflict-using-the-command-line/ Resolving a merge conflict using the command line].</div></td></tr>
</table>Marc-andre-hermanns-bc32@rwth-aachen.dehttps://hpc-wiki.info/hpc/index.php?title=Git&diff=4945&oldid=prevKamil-braschke-0d3e@uni-wuppertal.de at 12:49, 21 September 20222022-09-21T12:49:38Z<p></p>
<table class="diff diff-contentalign-left diff-editfont-monospace" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="en">
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Older revision</td>
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 12:49, 21 September 2022</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l1" >Line 1:</td>
<td colspan="2" class="diff-lineno">Line 1:</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>[[Category:Basics]][[Category:HPC-User]]</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>[[Category:Basics]][[Category:HPC-User]]</div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;">[[Category:Tutorials|Git Tutorials: Basic Git Overview]]<nowiki /></ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;">{{DISPLAYTITLE:Git Tutorial: Basic Git Overview}}<nowiki /></ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;">{{Syllabus Git Tutorials}}</ins></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>Git is a version-control system, commonly used for managing source code and coordinating the work of multiple contributors on a software project.</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>Git is a version-control system, commonly used for managing source code and coordinating the work of multiple contributors on a software project.</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
</table>Kamil-braschke-0d3e@uni-wuppertal.dehttps://hpc-wiki.info/hpc/index.php?title=Git&diff=2076&oldid=prevDaniel-schurhoff-de23@rwth-aachen.de at 13:52, 3 September 20192019-09-03T13:52:46Z<p></p>
<table class="diff diff-contentalign-left diff-editfont-monospace" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="en">
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Older revision</td>
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 13:52, 3 September 2019</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l1" >Line 1:</td>
<td colspan="2" class="diff-lineno">Line 1:</td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;">[[Category:Basics]][[Category:HPC-User]]</ins></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>Git is a version-control system, commonly used for managing source code and coordinating the work of multiple contributors on a software project.</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>Git is a version-control system, commonly used for managing source code and coordinating the work of multiple contributors on a software project.</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
</table>Daniel-schurhoff-de23@rwth-aachen.dehttps://hpc-wiki.info/hpc/index.php?title=Git&diff=1029&oldid=prevFabian-schlebusch-e0e3@rwth-aachen.de: Wrote first version of git article.2018-10-01T11:43:53Z<p>Wrote first version of git article.</p>
<p><b>New page</b></p><div>Git is a version-control system, commonly used for managing source code and coordinating the work of multiple contributors on a software project.<br />
<br />
From a user perspective, the workflow is divided into two stages: first, there are the changes you make to your local copy of the project.<br />
This local copy is called the ''local repository''.<br />
Then, there is also the ''remote repository'' to which the contributors ''push'', i.e., upload, their changes or ''pull'' the current version of the project.<br />
The main advantage is that all contributors can work on their part of the project simultaneously and ''merge'' their changes later on.<br />
<br />
The changes are organized as ''commits''.<br />
Whenever you feel that you have reached a certain goal, e.g. you fixed a bug or implemented a new feature, you should commit your changes.<br />
It is good practice to make only few changes per commit.<br />
<br />
You can also organize the work in ''branches'', where each branch has it's own timeline of commits.<br />
One branch can be branched from another, copying the state of the branch at this specific point.<br />
From then on, they can be worked on independently.<br />
Branches can later be merged again.<br />
This feature is used e.g., if a new feature is implemented in your project.<br />
Then, you would create a new branch where this feature is developed and merge it into the master branch as soon as the development is finished.<br />
<br />
== Creating a Repository ==<br />
Before you can start using git productively, you will have to create a git repository first.<br />
You can create a git repository using a hosting service of your choice.<br />
If you are a member of the RWTH Aachen, you can use the [https://git.rwth-aachen.de/ GitLab].<br />
Otherwise, e.g. [https://github.com/ GitHub] is a free and popular hosting service.<br />
Both provide you with a powerful web interface and rights management, so that you can control who can access or make changes to your project.<br />
It might become necessary that you generate an [[SSH]] key to prove your identity when you access the remote repository.<br />
<br />
== Basic Usage==<br />
When you want to start working with your repository, you will have to clone it to your machine first.<br />
Hosting services usually provide a button labeled 'clone' from which you can copy the repository's URL.<br />
<syntaxhighlight lang="bash"><br />
user@cluster.rz.rwth-aachen.de: $ git clone https://github.com/MyRepository.git<br />
</syntaxhighlight><br />
Assuming that your repository is called MyRepository, git will automatically create a directory with this name and download all files in this repository to your machine.<br />
<br />
If you already cloned your repository to your machine and you want to start working after a break, you should pull from the remote repository. <br />
This will ensure that you have the most recent changes on your machine when you start working.<br />
<syntaxhighlight lang="bash"><br />
user@cluster.rz.rwth-aachen.de: $ git pull<br />
</syntaxhighlight><br />
<br />
Before you start working, when you are done with your work or if you want to commit your changes, it is a good idea to request the repository's status from git.<br />
<syntaxhighlight lang="bash"><br />
user@cluster.rz.rwth-aachen.de: $ git status<br />
</syntaxhighlight><br />
<br />
When you have worked on your source code and reached a point where you feel confident to commit your changes, you have to tell git which files you want to commit.<br />
Ask git for the repository status and it will give you a list of all files that have changed.<br />
Then, you can selectively ''stage'' files for your commit, i.e. add them to the list of files for your commit.<br />
<syntaxhighlight lang="bash"><br />
user@cluster.rz.rwth-aachen.de: $ git add File0 [File1 ...]<br />
</syntaxhighlight><br />
<br />
Always confirm that you have staged the correct files by taking a look at the status!<br />
If everything is correct, you can commit your changes and add a description of your changes.<br />
<syntaxhighlight lang="bash"><br />
user@cluster.rz.rwth-aachen.de: $ git commit -m "I changed everything."<br />
</syntaxhighlight><br />
<br />
Git will confirm your commit and then you are ready to push your changes to the remote repository.<br />
<syntaxhighlight lang="bash"><br />
user@cluster.rz.rwth-aachen.de: $ git push<br />
</syntaxhighlight><br />
<br />
== Advanced Stuff ==<br />
If you and another contributor have worked on the same files and git cannot automatically resolve these conflicts, the merge conflicts have to be resolved manually.<br />
A good tutorial on how to merge your changes can be found in the GitHub Documentation: [https://help.github.com/articles/resolving-a-merge-conflict-using-the-command-line/ Resolving a merge conflict using the command line].<br />
<br />
A more detailed explanation of branches can be found here: [https://git-scm.com/book/en/v1/Git-Branching-What-a-Branch-Is Git - What a Branch Is].<br />
<br />
If you have made a mistake and already commited your changes, you can resort to [https://www.atlassian.com/git/tutorials/undoing-changes/git-revert git revert] or [https://www.atlassian.com/git/tutorials/undoing-changes/git-reset git reset].<br />
The latter should however be used very carefully.<br />
<br />
== Git With GUI ==<br />
For unexperienced users, using the shell can still be difficult.<br />
Then, you might want to use a graphical user interface (GUI) for git.<br />
Some of the most popular git GUIs are [https://tortoisegit.org/ TortoiseGit], the [https://desktop.github.com/ GitHub Desktop Client] or [https://www.sourcetreeapp.com/ SourceTree].<br />
Further, some IDEs have a git integration, e.g. [http://www.vogella.com/tutorials/EclipseGit/article.html Eclipse's EGit]<br />
<br />
== References ==<br />
[https://git-scm.com/docs Git Docs]</div>Fabian-schlebusch-e0e3@rwth-aachen.de