git what is branch code example

Example 1: git branch

git checkout -b <new-branch-name> # create a new branch
git switch <branch-name> # Switch branch

Example 2: git branch

git rm file.java
git commit -m "removing"
git push origin master
git branch BranchName :- Creating branch
git branch :- checking branch master
git checkout BranchName :- name is a branch name where you want to switch
git branch -d BranchName :- deleting brach on local
git push origin : deletedBranchName :-
 deleting Branch deteled on local(intellij) from Remote(gitHub WebSite)
git branch -a :- Cheking all branchs even deleted on Local (but not in remote)
git checkout -b BranchName :- Creating branch and Switching to the new branch
git merge BranchName :- Merging branch
git push --set-upstream origin BranchName :-
Pushing branch to remote (gitHub WebSite) from local (intellij)
git fetch origin BranchName :-
Pulling branch to local (intellij) from remote(github WebSite)
git push origin branch1:branch2
git pull origin branch1:branch2