TestingDocs.com
Software Testing website
  • Automation
    • Selenium
    • JBehave Framework
  • Tutorials
    • MySQL Tutorials
    • Testlink
    • Maven
    • Git
  • IDEs
    • IntelliJ IDEA
    • Eclipse
  • Flowcharts
    • Flowgorithm
    • Raptor
  • About

Git

What is Branching?

What is Branching?

Branching is what happens when you want to work on multiple features at the same time. You wouldn’t want to end up with a master branch that has Feature 1 half done and Feature 2 half done. Furthermore, we would separate the code base into “snapshots” (branches) and work on and commit to them separately. As soon as we are ready, we might merge this branch back into the master branch and push it to the remote server.

When developers are working on a feature or bug they’ll often create a branch of their code they can make separate commits to. Then when they’re done they can merge this branch back into their main master branch.

branching

 

Creating a branch

/> git branch <branch_name>

We can switch branches using the git checkout <branch> command. You can also use -b to do both the things together( create a branch and checkout ):

/> git checkout -b new_branch

https://www.testingdocs.com/create-a-git-branch/

What is a pull request?

A pull request allows the project owner or code reviewer to look through your changes and make comments before deciding to merge in the change. It’s a really great feature that is used all the time for remote workers and open-source projects.

https://www.testingdocs.com/create-a-pull-request/

 

Pull Request

Git merge:

We might want to merge the changes from the branch into the master branch. Something like below, when you are on the master branch. Telling Git to merge the <branch_name>

/> git merge <branch_name>

Merge Conflicts can occur when changes are made to a file at the same time. When merge conflicts, we just need to decide which code to keep. There are tools to help to resolve merge conflicts.

https://www.testingdocs.com/resolving-merge-conflicts-on-github/

Delete a branch:

We can use the below command to delete a branch. For example to clean bug_fix branch :

/> git branch -d <branch name>

/> git branch -d bug_fix

Related Posts

Git Install on Linux

Git /

Install Git on Ubuntu Linux

Version_Control_Centralized

Git /

Overview of Version Control Systems

Git Website

Git /

Getting Started with Git Version Control

Install Git on Windows 10

Git /

Install Git on Windows 10

Git Bash App

Git /

Set Up Git Bash On Windows 10

‹ Install Git on Ubuntu Linux

Recent Posts

  • MS Access Data Types
  • Install RAPTOR Avalonia on CentOS
  • Download RAPTOR Avalonia Edition on Windows
  • npm doctor command
  • Build & Run CLion Project
  • Create New CLion C Project on Windows
  • Configure CLion Toolchains on Windows
  • Launch CLion IDE on Windows
  • Activate CLion IDE
  • CLion IDE for C/C++ Development

Back to Top

Links

  • Contact
  • Privacy Policy
  • Cookie Policy

www.TestingDocs.com

Go to mobile version