This is a tool that could let us to save different version of our work and collaborate as well with other team meat in a project. There are different version controlling platforms like git, sandbox, and many more.
Setting Up Versions
in order to use a version control, the first step is to configure your project to support a git version control. To do that , create a folder, and type the following command
git init , and press enter // This will initialize your project folder as git instant
Setting up a Repository
The next step is setting up a repository that could let you to push your work in a remote cloud space. It is possible to choose any version controlling platform that your prefer to set up your project. The following are the step create a repository
- Set a name for your repository.
- Clone the repo to your local machine
- Start creating your project in the main/your branch
- Create a PR and ask for review
- Then Merge/Complete the PR
Branching
Branch is an instant path of a Main branch. Its purpose is to create a path for our work independent of the main branch that is common for all the user. This could help to do our work independently without touch the common branch and later merge our work with the main brach accepting what has been done after our branch.
Conflicting
This is a condition that our changes are not aligned with the change already merge in the main branch after our last version of the main branch. The following are the techniques to avoid big conflicts
- Communication between developers – if there are working in the same module
- Constant pulling change form the main branch and merge to your branch – This could help you to align your brach with the main branch regualrly.
Figure 1.1 : – Conflict In Git Version Commands
Command in version controlling
- git clone
- git add .
- git commit -m
- git push
- git difference
- git merge
- git status
- Many others
How To collaborate
Version controlling let us to work with a team members and deliver our version of code to the entire product. In order to work with the team, the following steps should be followed considering that the project is already in a remote cloud. To start collaborating to the team, follow the following steps
- Start Bt Cloning the project in your local machine – git clone <project-URL>
- Build the project Locally correctly
- Create your branch – git checkout -b new-branch
- Start modifying , Add and Commit your work – git add . & git commit -m “comment”
- Push your branch version to remote – git push –set-upstream origin new-branch
- Check our to the main branch , and pull changes – git checkout main , git pull
- Merge your branch to the main branch locally- if there are conflicts resolve it – git merge ourLocalBranch
- Push your change to remote branch of yours
- Create a PR and assign a reviewer
- Then after the approval of the reviewer, merge your changge to the main branch. This could automatically complete your work,
Figure 1.2 : – Git Version Commands