what is a branch in git code example

Example 1: how to make a new branch git

$ git checkout -b [name_of_your_new_branch]

Example 2: git branch

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

Example 3: create a branch command

$ git push origin :[name_of_your_new_branch]

Example 4: git branch

git checkout -b <new-branch-name>

Example 5: 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

Example 6: git branch

$ git branch iss53
$ git checkout iss53

Tags:

Misc Example