... | @@ -2,11 +2,11 @@ |
... | @@ -2,11 +2,11 @@ |
|
|
|
|
|
## Install git
|
|
## Install git
|
|
|
|
|
|
If git is not furnished by your OS, you can download from [the official git website](https://git-scm.com/downloads).
|
|
If git is not supplied by your OS, you can download it from [the official git website](https://git-scm.com/downloads).
|
|
|
|
|
|
## Configure git
|
|
## Configure git
|
|
|
|
|
|
Before starting to use git, you have to configure a few variables to specify your name, email, and your editors.
|
|
Before starting to use git, you have to configure a few variables to specify your name, email, and editors.
|
|
|
|
|
|
```
|
|
```
|
|
git config --global user.name "Jon Doe"
|
|
git config --global user.name "Jon Doe"
|
... | @@ -67,7 +67,7 @@ git add -p file3.cpp |
... | @@ -67,7 +67,7 @@ git add -p file3.cpp |
|
```
|
|
```
|
|
To see the current status, use :
|
|
To see the current status, use :
|
|
- `git status` to list the files that will be included in the next commit
|
|
- `git status` to list the files that will be included in the next commit
|
|
- `git diff --cached` to list the modification that will be included
|
|
- `git diff --cached` to list the modifications that will be included
|
|
- `git diff` to list the modifications that won't be included.
|
|
- `git diff` to list the modifications that won't be included.
|
|
|
|
|
|
Once a coherent set of modifications is in the index, the actual commit can be performed.
|
|
Once a coherent set of modifications is in the index, the actual commit can be performed.
|
... | @@ -117,7 +117,7 @@ If conflicts occur during a rebase or a merge, git will stop and you will have t |
... | @@ -117,7 +117,7 @@ If conflicts occur during a rebase or a merge, git will stop and you will have t |
|
## Accept a merge request
|
|
## Accept a merge request
|
|
|
|
|
|
First check that the commits in the branch do not break the testcases (the gitlab server should put a green icon beside the commit and on the page of the merge request) and that the code looks good.
|
|
First check that the commits in the branch do not break the testcases (the gitlab server should put a green icon beside the commit and on the page of the merge request) and that the code looks good.
|
|
If it's not the case, you can discuss the modifications on the page of the merge request on gitlab and ask for changes. Once, the branch is satisfactory merge it into master.
|
|
If it's not the case, you can discuss the modifications on the page of the merge request on gitlab and ask for changes. Once the branch is satisfactory, merge it into master.
|
|
|
|
|
|
```
|
|
```
|
|
git fetch
|
|
git fetch
|
... | @@ -135,7 +135,7 @@ git push origin --delete myfeature |
... | @@ -135,7 +135,7 @@ git push origin --delete myfeature |
|
|
|
|
|
## (Optional) Clean a branch
|
|
## (Optional) Clean a branch
|
|
|
|
|
|
Before requesting a merge of your branch into master, you may wish to clean its history (e.g. to combine commit with another commit that fix it).
|
|
Before requesting a merge of your branch into master, you may wish to clean its history (e.g. to combine commit with another commit that fixes it).
|
|
Always do it in a copy of your branch.
|
|
Always do it in a copy of your branch.
|
|
```
|
|
```
|
|
git fetch
|
|
git fetch
|
... | @@ -152,7 +152,7 @@ Then follow the instructions. |
... | @@ -152,7 +152,7 @@ Then follow the instructions. |
|
|
|
|
|
**Never reset a branch in a way that would remove or alter commits that are already pushed to the server**.
|
|
**Never reset a branch in a way that would remove or alter commits that are already pushed to the server**.
|
|
If you want to remove changes already pushed to the server, you can either
|
|
If you want to remove changes already pushed to the server, you can either
|
|
- create a new branch, fix it's history then push it
|
|
- create a new branch, fix its history then push it
|
|
- or create a new commit that will revert the changes introduced by a previous commit using `git revert rev` (replace rev by the hash of the commit).
|
|
- or create a new commit that will revert the changes introduced by a previous commit using `git revert rev` (replace rev by the hash of the commit).
|
|
|
|
|
|
## (Optional) Others
|
|
## (Optional) Others
|
... | | ... | |