Git & Github - 3

Kusuma VKusuma V
2 min read

Git Branches

to create a branch git branch branchname

to change one branch t o another git checkout branchname

# Without commit in branch we should not check out to other branch, if not the information will come to other branch also

to delete branch git branch -d branchname

After commit we can observe the changes, we can say that, code will not be shown in master branch

to check how many branch have git branch

to rename the branch & if you are in other branch & rename previous branch

git branch –m oldname newname

to change the branch name , if you are in same branch &wants to change its name than git branch –m newname

git diff sample (it will compare with master branch)

example

Git merger sample (it will merger with master branch)

While checkout we want to create a new branch git checkout –b sample

How to push all branch to remote repo Git push sample --all

How to delete the branch git branch -d sample

Tags

Difference between branch & Tags

branchtags
it is mutableimmutable
on developmentafter production development
git branchgit tag
git branch branchnamegit tag tagname
git push filename branchnamegit push file nametag tagname
git push filename -allgit push filename -tags
git branch -d branch branchnamegit push sample -tags

Whatever the code which is their in branch will be created as zip file or tar file by tag command To delete

0
Subscribe to my newsletter

Read articles from Kusuma V directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Kusuma V
Kusuma V

Passionate about staying updated with the latest advancements in cloud computing and DevOps practices, I am committed to driving innovation and delivering value through technology.