Git Tutorial¶
1. Start working¶
When you start your day coding, you want to pull the incoming changes
2. Commit your changes¶
Once you’ve made some changes that work, you want to commit these changes so that they exist in the git log
# Stage the changes
git add .
# Commit the changes to the current branch
git commit -m "[YOUR-COMMIT-NAME-HERE]"
3. Push changes to GitLab¶
4. Working on a new feature¶
Whenever you are going to work on a new feature or a new scrum card, you want to create a new feature branch.
First, make sure you are working on the ‘develop’ branch
# Switch to 'develop' branch
git checkout develop
# Pull the incoming changes from 'develop'
git pull
# Now make a feature.md branch based on 'develop'.
# Make sure the name includes the: '/feature.md' annotation
git checkout -b "[YOUR-BRANCH-NAME]"
# Lastly, you'll want to send your feature.md branch to the server
git push --set-upstream origin "[YOUR-BRANCH-NAME]"
5. Merging my feature branch with GitLab¶
Done working on a feature? Here’s what you do. While on the feature branch:
-
Update the branch with the incoming changes from ‘develop’
-
Got a merge conflict? Follow these steps. Proceed to step 4
-
Go to GitLab -> ‘Merge requests’ and click on ‘Create merge request’
-
Make sure your are merging to the correct branch, which is ‘develop’.
Correct? Click: Compare branches and continue
-
Insert a suitable title
-
In the description, you’ll find the definition of done. Check if your feature meets the definition of done requirements. If they do, tick them off using ‘- [x]’
-
Assign a reviewer. This person has to accept your merge request for it to be merged.
-
You can add a Milestone if neccesary
-
Click: ‘Create merge request’
6. Resolving merge conflicts¶
If you’ve pulled the ‘develop’ branch into your feature branch, it is possible you’ll get a merge conflict. Follow the next instructions to resolve this.
- Within VSCode, go to the file containing the conflict.
You’ll see something similar to the screenshot below:
-
Solve the conflicts, then commit the Merge commit to the feature branch.
-
Now make the merge request using these steps