The main difference is that GIT is a Control Versions software meanwhile GitHub and GitLab are platforms on the WEB able to work with this software and allow use them as remote repositories to save your changes made on your local repository, in this case, your PC. These platforms have different functionalities for improve the experience using GIT.
Explain why Git can be used by a development team without need of platforms such as Github or Gitlab.
GIT is powerful even without platforms such as GitHub or GitLab help because you can work your changes on your local repository or even through emails.
Your repository can be hosted on your computer or teammate computer.
It is not necessary create a remote repository you can define it on local paths.
Well, the main use for GIT as mentioned on the question is Source Code Management but has had a great impact and influence on the software industry because this software implement new characteristics such as:
- One more user, allowed to work on a specific file.
- GIT is distributed, you can work with it as different ways, locally or remotely.
- GIT introduced branch concept.
- GIT has a staging area.
These characteristics allowed improve the collaboration, the versions management and set a specific workflow for the projects. With all these facilities new methodologies and tools were born, the way to handle code has changed completely. This allow build projects faster than years ago.
- GitLab
- Bitbucket
- Apache Subversion
- Beanstalk
- AWS CodeCommit
- Mercurial
The process on GitHub to create a repository is the following:
- Go to the right top corner of the platform and click on your image profile
- Click on your repositories option
- Then click on the New button, it is green.
- Choose a repository name and description and finally click on create.
The described above is using a GUI, after that you have to initialize your repo using CLI.
We have two options to initialize a Repository:
- Create a new repository on the command line
echo "# example" >> README.md
git init
git add README.md
git commit -m "firs commit"
git branch -M main
git remote add origin https://github.com/genaro/example.git
git push -u origin main
- Push an existing repository from the command line
git remote add origin https://github.com/genaro/example.git
git branch -M main
git push -u origin main
Branches are important because you can work on different versions of the same project at the same time with your teammates. While some developers will be fixing bugs, others will be implementing new features, etc. You can reject or approve these changes using a merge request function, if you use it, the source code will always be safe.
The working directory is the local path that you are working example Desktop/Genaro/Project, the files are not handle by GIT in this stage. It's where you can add new content, you can modify delete content, if the content that you modify or delete is in your repository you don't have to worry about losing your work.
The staging area, that's what files are going to be a part of your next commit. It's how GIT knows what is going to change between the current commit and the next one. It's like a living room for your changes before to proceed to Local Repository.
And the remote repository is a place out of your local computer where your changes will save, this remote repository can be hosted on a web platform such as GitHub or GitLab.
Explain what is a Branching Model and describe how it would you use it if your team wants to add 3 features to one application.
Branching model is a schema where you can define your strategy or your approach to make changes and commit them back to your codebase or source code. This schema consist in create new branches to work on different areas from the codebase at the same time with somebody else, this allow that your changes don't affect to your teammate changes.
A good practice is include a .gitignore
folder always that you created a new repository to avoid this issues. You can add the name of a path or even certain file extensions. For example if we have a path where there are files that are created automatically, just add this path to .gitignore folder.