What is git?
Git is a mature, actively maintained open source project originally developed in 2005 by Linus Torvalds, the famous creator of the Linux operating system kernel. A staggering number of software projects rely on Git for version control, including commercial projects as well as open source.
In the team project git is the important thing when you work on the team project here are the step that you can apply in the team project
- First make a repository
A Git repository is a virtual storage of your project. It allows you to save versions of your code, which you can access when needed. - Git init
To create a new repo, you’ll use the $ git init command. git init is a one-time command you use during the initial setup of a new repo. Executing this command will create a new subdirectory in your current working directory. This will also create a new master branch.
$ cd /path/to/your/existing/cod
$ git init - Git Clone
If you have already an repository you can git clone to existing repository
$ git clone <repo url> - Branching
A branch represents an independent line of development. Branches serve as an abstraction for the edit/stage/commit process. You can think of them as a way to request a brand new working directory, staging area, and project history.
$ git branch
List all of the branches in your repository. - Git Checkout
The git checkout command lets you navigate between the branches created by git .
$ git checkout -b <branch name>
the command up there is to make a new branch and switching from branch master to your new branch - Git Push
if you already have a file in your repository here are the step for you to push your repo to a gitlab repository
first,make $ git add . to push all your file in your local branch/repository.if you just want a single file command $ git add <filename> . Second, command $ git commit -m “<message>” the command is to know what are you doing/change.Last $ git push origin <branch name>,the command is to pushing your file to a gitlab repository if succes the message is like this.
7. Git Merge
If you want a make request to other branch you can a merge request by create a merge request.Then need an approval by your team. Here some example:
Thats that i want you to know about my experience by using git in my project.Thank you for reading my article.
references:
https://www.atlassian.com/git/tutorials/using-branches/merge-conflicts