This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
devs:usegit [2022/04/05 16:36] helene [2.4 Merging] |
devs:usegit [2022/04/05 16:40] (current) helene |
||
---|---|---|---|
Line 69: | Line 69: | ||
=== 2.3.2 Committing a part of your changes === | === 2.3.2 Committing a part of your changes === | ||
Example: I modified the subroutine CHAB.F to correct some calculation, and I deleted useless comments in CHABDAM.F. These are two different changes that should be committed separately. In a first time, I am only going to commit the changes made in CHABDAM.F by using the 'indexing' function. Only the changes made to the indexed routines will be taken into account in the commit (see <imgref image9>). | Example: I modified the subroutine CHAB.F to correct some calculation, and I deleted useless comments in CHABDAM.F. These are two different changes that should be committed separately. In a first time, I am only going to commit the changes made in CHABDAM.F by using the 'indexing' function. Only the changes made to the indexed routines will be taken into account in the commit (see <imgref image9>). | ||
+ | |||
<imgcaption image9|>{{ :devs:commit2.png?nolink&600 |}}</imgcaption> | <imgcaption image9|>{{ :devs:commit2.png?nolink&600 |}}</imgcaption> | ||
Line 78: | Line 79: | ||
* Reset and delete changes (--hard) | * Reset and delete changes (--hard) | ||
__Example__: I committed changes on CALMAT2 but I want to change my commit message. In <imgref image10>, you can view the history of the branch. The red arrow « origin/Helene » indicates the last commit made on the distant branch. The arrow « Helene » indicates the last commit made on my local branch. My local branch is one commit ahead of the server. | __Example__: I committed changes on CALMAT2 but I want to change my commit message. In <imgref image10>, you can view the history of the branch. The red arrow « origin/Helene » indicates the last commit made on the distant branch. The arrow « Helene » indicates the last commit made on my local branch. My local branch is one commit ahead of the server. | ||
+ | |||
<imgcaption image10|>{{ :devs:commit3.png?nolink&600 |}}</imgcaption> | <imgcaption image10|>{{ :devs:commit3.png?nolink&600 |}}</imgcaption> | ||
To reset my local branch and delete the last commit, I can right-click on the last commit of the server (here commit 6697b587 « ILAW=21 ; Lecture theta – IVAL 21 »), and select « Reset » and then chose between keeping or deleting changes. In my case, since I only want to change the commit message, I keep the changes so I can commit them again afterwards. \\ | To reset my local branch and delete the last commit, I can right-click on the last commit of the server (here commit 6697b587 « ILAW=21 ; Lecture theta – IVAL 21 »), and select « Reset » and then chose between keeping or deleting changes. In my case, since I only want to change the commit message, I keep the changes so I can commit them again afterwards. \\ | ||
Line 112: | Line 114: | ||
=== 2.4.3 Merging your changes into the master === | === 2.4.3 Merging your changes into the master === | ||
The Master branch is a protected branch, therefore merging into it can only be done on the GitLab website. \\ | The Master branch is a protected branch, therefore merging into it can only be done on the GitLab website. \\ | ||
- | In order to make a merge with GitLab – that is, to put the modification from your branch into the official version of the code (master branch) – it is advised to first merge the master branch into your branch using Visual Studio (see 2.4) to solve potential merge conflicts. \\ | + | In order to make a merge with GitLab – that is, to put the modification from your branch into the official version of the code (master branch) – it is advised to first merge the master branch into your branch using Visual Studio (see section 2.4.2) to solve potential merge conflicts. \\ |
\\ | \\ | ||
To make the merge in GitLab, go to the Lagamine page ⟶ Repository ⟶ Branches. \\ | To make the merge in GitLab, go to the Lagamine page ⟶ Repository ⟶ Branches. \\ | ||
\\ | \\ | ||
You can then click the « Merge request » button corresponding to your branch. You will then have to input a title for the merge (as done for the commits). | You can then click the « Merge request » button corresponding to your branch. You will then have to input a title for the merge (as done for the commits). | ||
+ | |||
+ | ===== 3 Useful links ===== | ||
+ | * Documentation on how to use Git in Visual Studio: https://docs.microsoft.com/en-us/azure/devops/repos/git/gitquickstart?view=azure-devops&tabs=visual-studio-2019 | ||
+ | * GitLab documentation: https://docs.gitlab.com/ee/index.html | ||
+ | |||
+ | |||