How to Git
Git is a distributed version control system (VCS) that allows multiple people to work on the same project simultaneously.
Why do we use Git?
In the following weeks, you have to solve exercises to put the theory of the lectures in to practice. With Git, we can hand the exercise template to you and you can send us your solutions so we can give feedback. Git is also beneficial for several reasons:
Version Control: Git allows you to maintain a history of your project. You can roll back to previous versions, compare changes, and understand the evolution of your code or content over time.
Collaboration: Git is a distributed version control system, meaning multiple people can work on the same project simultaneously without stepping on each other's toes. They can merge their work seamlessly, facilitating teamwork.
Backup and Redundancy: By pushing your repository to remote platforms like GitHub, GitLab, or Bitbucket, you ensure there's an online backup of your project.
Branching and Merging: Git's branching model is one of its strongest features. It allows you to create separate branches for features, fixes, experiments, etc., and then merge them back into the main line of development when ready.
How to connect Eclipse with Gitlab
Look at the official exercise (ex1) for a detailed guide. As an additional tip make sure to not copy & pasting the link given as it might contain non-visible formatting characters that mess with Eclipse finding the repository.
1. Push after Pull:
When pushing, the online repository gets updated with the edited copy saved on your laptop. If someone else has pushed changes to the same branch after your last pull, and your current changes conflict with theirs, you'll receive a conflict error when trying to push. This requires you to pull their changes, merge them with yours, and then push the merged changes. So always pull first before pushing
2. Always Commit and Push
When you commit, the local repository gets updated but NOT the online repository so nobody can see or evaluate your work!
3. Not Committing Often Enough
Waiting too long to commit can make it harder to understand the history and to merge changes.