Branching of git
1. git branch (check which branch is active)
2. git branch <branchName> (create a new branch) [e.g. git branch test-branch]
3. again git branch (check again which branch is active, in this case main branch will be active)
4. git checkout <createdBranchName> (you will shift your created branch) [e.g. git checkout test]
5. Now edit your code. After making the necessary changes, push it to Git Hub.
6. git push origin <createdBranchName> (it will add your code to the branch) [git push origin test]
if your code are all okay, then you have to marge
How to Merge your Code:
1. git checkout main (before merge you have to shift the main branch)
2. git merge <createdBranchName> (merging will be completed) [e.g. git merge test]
3. git push -u origin main [e.g. git push -u origin main]
now if you want to delete branch from your local computer then do the below:
How to Delete Created Branch:
1. git branch -d <createdBranchName> (locally delete your branch, but will remain in the github website>) [e.g. git branch -d test]
How to delete a branch from the GitHub website:
1. git push origin --delete <createdBranchName> [git push origin --delete test]
Post a Comment