SAGARFIVE

1. Introduction

2. Git Basics

3.  Git Terminology

4.  Git Branching

5.  Git - Github

6.  Git Add (Git staging)

7.  Git Commit

8.  Github Advanced

9.  Git Remote

4.1 Git Branch

image credit : wavemaker
  • This feature is provided in git, so that developers can create code related to different functionalities on separate branches.
  • This helps the development team in creating the code in an uncluttered way. Later this code can be merged with the master branch.
  • Master is final developed code that can move to testing , beta and production servers.
  • Simple project structure of Git types of branches : Feature branches, Develop, Release branches, Hotfixes, Master
  • Here we can see , programmers develop project features at feature branches,  if feature initial unit testing done, result is perfect than he merge that branch with Develop branch, next release , next hotfixes (production code bug fix),  next to master → testing server → beta server → Production server.
  • By default branch in git is master
  • By Default branch in github is main

1Creating new branchgit branch <branch-name>Ex: git branch feature-1
2Rename branchgit branch -m <new-name>Ex: git branch -m “feature-one”
3Move to a branchgit checkout <branch-name>Ex: git checkout feature-1
4List the all branchesgit branch or git branch –lor git branch –list
5Merge branch from existinggit merge <another-branch>Ex: git merge master
6Delete a local branchgit branch -d <branch-name>Ex: git branch -d test-branch
7Delete a Remote branchgit push origin -d <branch>Ex: git push origin -d test2
8Commit a code at a stagegit commit -m “commit1 or any”
9To see commit for branchgit log –oneline