Git Branching - Introduction
Branching in a production environment ensures that the stable, production-ready code is kept separate from ongoing development work, reducing the risk of errors or disruptions. For example, a feature can be developed in a separate branch (e.g., feature/login-system) while the production code remains intact. This allows for parallel development, quick bug fixes through hotfix branches, and safe deployments without affecting the live system. Once features are ready and tested, they can be merged into the master branch for deployment.
When you initialise Git in a directory, it automatically creates a master branch by default. However, it’s recommended not to work directly on the master branch.
It is recommended to create a separate branch for each task. After completing the work on a branch, merge it back into the master branch. This approach facilitates parallel development.
Key Points to remember:
1. You can create as many branches as needed, with changes being specific to each individual branch. The default branch is the master branch.
2. When a new branch is created, it copies the data from the existing branch.
3. Files created within a workspace are visible across any branch's workspace until they are committed. Once committed, the file is associated with that specific branch.
Commands:
To check Commit History: git log --oneline
To see available Branches: git branch
Creating a New Branch: git branch branch-name
Switching Between Branches: git checkout branch-name
Deleting a Branch: git branch -d branch-name
🔔 Don't forget to like, comment, and subscribe for more educational content. Your feedback helps us improve and deliver quality tutorials tailored to your learning needs.
#git for beginners
#git tutorial for beginners
#git tutorial
#git and github tutorials
#github tutorial for beginners
#git for beginners
#what is git
#git tutorial for beginners
#github tutorial
#git tutorial
#git and github tutorial
#git commands
#git basics
#git commands with examples
#Easy to understand GIT
#Learn git
#Git and GitHub Tutorial
#What is git?
#Git basics commands
#Git bash
#Git flow
#git Pull
#git push
#git commit
#git remote
#git status
#git log
#git add
#git branch
#git merge
#git restore
#git checkout
#best video on git
#best git tutorial
#best git video
#git best video
#best git video
#git vide
コメント