Git & Github - 3

Git & Github - 3

·

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