 
                
            GIT
What is GIT?
Git is a free and open-source distributed version control system designed to handle everything from small to very large projects with speed and efficiency. Git allows multiple developers to collaborate on a project and keep track of changes to the codebase over time.
Concepts
Repository
A Git repository is a collection of files and folders, along with a history of changes made to them. Each repository has a unique URL that identifies it on the internet. You can create a repository either locally on your computer or on a remote server such as GitHub, GitLab or Bitbucket.
Commit
A commit in Git represents a snapshot of the changes made to the files in the repository at a particular point in time. Each commit has a unique identifier, called a hash, which allows you to reference it later. When you commit changes to a repository, you need to provide a commit message that describes the changes you made.
Branch
A branch in Git is a parallel version of the repository. It allows you to work on different versions of the same codebase simultaneously without interfering with each other’s work. You can create a branch from an existing branch or the main branch (usually called “master” or “main”). When you create a new branch, you can switch to it to start making changes.
Merge
Merging in Git means combining changes from one branch into another. When you merge two branches, Git will try to automatically merge the changes, but sometimes conflicts may arise that need to be resolved manually.
Pull Request
A pull request in Git is a way of proposing changes to a repository. When you submit a pull request, you’re asking the repository’s owner to merge your changes into their codebase. Pull requests are commonly used in open-source projects where contributors want to share their changes with the community.
Commands
Git Commands Here are some of the most common Git commands you’ll need to know:
git clone
Clone a repository from a remote server to your local machine:
  git clone <repository-url>git add
Stage changes for the next commit:
  git add <file-name>git commit
Commit staged changes to the repository:
  git commit -m "<commit-message>"git push
Push committed changes to a remote server:
  git push origin <branch-name>git branch
List all branches in the repository:
  git branchCreate a new branch:
  git branch <branch-name>Switch to a branch:
  git checkout <branch-name>Create a new branch and switch to it:
  git checkout -b <branch-name>git merge
Merge changes from a different branch into the current branch:
  git merge <branch-name>git status
Show the status of the working directory:
  git statusIf you want to learn more about Git, check out the: Git Documentation.
Gitflow
Gitflow is a branching model for Git that provides a standardized way of managing your codebase. It was first introduced by Vincent Driessen in 2010, and since then it has become a popular workflow model among software development teams.
Gitflow defines a set of branch naming conventions and rules for creating and merging branches. It also provides a clear separation between feature development, release management, and maintenance.
The basic Gitflow workflow involves the following branches:
- master/main: The main branch where the source code of HEAD always reflects a production-ready state.
- develop: The main branch where the source code of HEAD always reflects a state with the latest delivered development changes for the next release.
- feature: Branches used to develop new features for the upcoming or a distant future release. They are branched off from the develop branch.
- release: Branches used to prepare a new production release. They are branched off from the develop branch.
- hotfix: Branches used to quickly patch production releases. They are branched off from the master branch.
Here are some examples of how Gitflow works:
- Creating a new feature branch:
  git checkout develop
  git checkout -b feature/new-featureThis creates a new branch called feature/new-feature off of the develop branch. All changes related to the new feature will be made in this branch.
- Merging a feature branch:
  git checkout develop
  git merge --no-ff feature/new-featureOnce the feature is complete and tested, it can be merged back into the develop branch. The —no-ff flag ensures that a new commit is created for the merge, preserving the history of the feature branch.
- Creating a release branch:
  git checkout develop
  git checkout -b release/1.0.0This creates a new branch called release/1.0.0 off of the develop branch. The team can now focus on testing and bug fixing for this release.
- Merging a release branch:
  git checkout main
  git merge --no-ff release/1.0.0
  git tag 1.0.0Once the release is ready, the changes are merged into the main branch and tagged with a release number. The —no-ff flag ensures that a new commit is created for the merge, preserving the history of the release branch.
- Creating a hotfix branch:
  git checkout main
  git checkout -b hotfix/1.0.1This creates a new branch called hotfix/1.0.1 off of the main branch. The team can now focus on fixing the bug in the production release.
- Merging a hotfix branch:
  git checkout main
  git merge --no-ff hotfix/1.0.1
  git tag 1.0.1
  git checkout develop
  git merge --no-ff hotfix/1If you want to learn more about Gitflow, check out the: Gitflow Workflow Documentation.
Next: ESLint