mirror of
https://gitlab.com/ric_harvey/git-guide.git
synced 2024-11-23 20:24:02 +00:00
54 lines
1.1 KiB
Markdown
54 lines
1.1 KiB
Markdown
# Bringing code back together
|
|
|
|
## Merge Requests in Gitlab
|
|
|
|
## Merging via the CLI
|
|
Lets take our example of making a branch for **issue 99**, the diagram below shows the current state of the git repository.
|
|
|
|
```mermaid
|
|
gitGraph
|
|
commit
|
|
commit
|
|
branch issue99
|
|
checkout issue99
|
|
commit
|
|
checkout main
|
|
commit
|
|
commit
|
|
```
|
|
|
|
Merging this is pretty simple, you can do it with the following instructions.
|
|
|
|
```bash
|
|
# Switch back to the main branch
|
|
git checkout main
|
|
|
|
# Merge the branches
|
|
git merge issue99
|
|
|
|
# Push the changes to the remote repository
|
|
git push
|
|
```
|
|
|
|
The diagram below shows what happened to our repository and how it got merged or flattened back into the **main** branch.
|
|
|
|
```mermaid
|
|
gitGraph
|
|
commit
|
|
commit
|
|
branch issue99
|
|
checkout issue99
|
|
commit
|
|
checkout main
|
|
commit
|
|
commit
|
|
merge issue99
|
|
commit
|
|
```
|
|
---
|
|
|
|
## Merge conflicts
|
|
|
|
##### Follow me for more guides
|
|
|
|
[<img src="./img/mastodon.png" width="4%">](https://awscommunity.social/@Ric) [<img src="./img/linkedin.png" width="4%">](https://www.linkedin.com/in/richarvey/)
|