Git branch are copy of master branch. When you want to add a new feature or fix a bug then require master copy of different lane that call git branch, it’s effectively a pointer to a snapshot of your changes.
Steps : Git branch
- create a code and commit
- Create new branch
- Code add and commit in new branch
- Rename branch
- Delete branch
Note: Before starting please ensure Git is install, if not click here...
Step 1: Create a code and commit
Switch administrator User command
# sudo su
Use “cd” command to move git initialize directory
# cd India_git_directory
Create a new code to use ” cat or vi ” command and Ctrl+D
# cat >master_git
this my new master git code
use those command to add and commit that created code
# git add .
# git commit -m “my master git code”
# git status
# git log –oneline
use ” git branch” Check present branch status
# git branch
Step 2: Create new branch
Use ” git branch ” command to create new branch
# git branch branch1
# git branch
# ls
Use ” git checkout” command to change new created branch1
# git checkout branch1
# git branch
# ls
Also, check created branch commit data : full copy of master branch
# git log –oneline
Step 3 : Code add and commit in new branch
use those command to create new data in new branch
# cat >branchfile
# git add.
# git commite -m “this is my branch commit file”
# git log –oneline
Check master branch is that branchfile available or not
# git checkout master
# git log –oneline
# ls ( file are not showing because that was commit but you can see that file before commit)
Step 4 : Rename branch
# git branch -m old-branch new-branch
Step 5: Delete branch
# git branch -D branch_rename
If, you want to delete from github or git lab
# git push origin –delete branch1
——————-END——————–
Install Git in Linux | Git log, Push, Pull
- Install Git
- Set up Git
- Create working file
- Check git log
- Create GitHub Account
- Generate and copy 2FA password
- Push and Pull working data to Github account for use world wide.
I’ve been browsing on-line greater than three hours these days, but I by no means discovered any fascinating article like yours. It’s pretty price enough for me. In my view, if all site owners and bloggers made good content as you probably did, the web will likely be much more helpful than ever before. “Nothing will come of nothing.” by William Shakespeare.