Difference between revisions of "Branching"
(Created page with "'''''Previous | Next | Guide to using Git with GEOS-Chem | Getting Started with GEOS-Chem | GEOS-Chem Main Page'''''...") |
(→Creating branches) |
||
Line 16: | Line 16: | ||
You will get a dialog box that prompts you for the new branch name. | You will get a dialog box that prompts you for the new branch name. | ||
− | [[Image:GitGuiNewBranch. | + | [[Image:GitGuiNewBranch.png]] |
− | The current branch name is displayed at the top left of the Git GUI, and will also be highlighted in the '''Create New Branch''' menu. | + | The current branch name is displayed at the top left of the Git GUI, and will also be highlighted in the '''Create New Branch''' menu. Your new branch will split off the currently checked-out branch. |
− | In the '''Create New Branch''' dialog box, type a unique branch name and then click OK. | + | In the '''Create New Branch''' dialog box, type a unique branch name and then click OK. Your new branch name should adhere to the [[Viewing_the_revision_history#Branches|Gitflow nomenclature]]. You will be automatically placed into the branch you have just created. |
---- | ---- | ||
Line 34: | Line 34: | ||
[[Image:GitkNewBranch.png]] | [[Image:GitkNewBranch.png]] | ||
− | + | Your new branch name should adhere to the [[Viewing_the_revision_history#Branches|Gitflow nomenclature]]. | |
=== Create a new branch from the command line === | === Create a new branch from the command line === | ||
Line 46: | Line 46: | ||
git branch feature/MyFeature | git branch feature/MyFeature | ||
git checkout feature/MyFeature | git checkout feature/MyFeature | ||
+ | |||
+ | Your new branch name should adhere to the [[Viewing_the_revision_history#Branches|Gitflow nomenclature]]. | ||
--[[User:Bmy|Bob Yantosca]] ([[User talk:Bmy|talk]]) 15:25, 20 June 2019 (UTC) | --[[User:Bmy|Bob Yantosca]] ([[User talk:Bmy|talk]]) 15:25, 20 June 2019 (UTC) |
Revision as of 15:28, 20 June 2019
Previous | Next | Guide to using Git with GEOS-Chem | Getting Started with GEOS-Chem | GEOS-Chem Main Page
Contents
Overview
On this page, we describe how to create new branches with Git.
Creating branches
There are several ways that you can create new branches with Git.
Use Git Gui to create a new branch
To create a new branch in the git gui, go to the Branch/Create on the menu bar (or type CTRL-N).
You will get a dialog box that prompts you for the new branch name.
The current branch name is displayed at the top left of the Git GUI, and will also be highlighted in the Create New Branch menu. Your new branch will split off the currently checked-out branch.
In the Create New Branch dialog box, type a unique branch name and then click OK. Your new branch name should adhere to the Gitflow nomenclature. You will be automatically placed into the branch you have just created.
Previous | Next | Guide to using Git with GEOS-Chem | Getting Started with GEOS-Chem | GEOS-Chem Main Page
Use Gitk to create a new branch
You can also create a new branch very quickly from the Gitk browser. Right click on any commit, and then pick: Create new branch
This will pop open a dialog box that asks you to pick the name of the new branch.
Your new branch name should adhere to the Gitflow nomenclature.
Create a new branch from the command line
First, check out the branch that you wish to branch off from. In this case, let's branch off master.
git checkout master
Then type
git branch feature/MyFeature git checkout feature/MyFeature
Your new branch name should adhere to the Gitflow nomenclature.
--Bob Yantosca (talk) 15:25, 20 June 2019 (UTC)
Determining which branch you are on
You can determine which branch you are on as follows:
Using this: | Follow these steps: |
---|---|
Git GUI | Look at the top left (under the Repository menu), and you will see the name of the currently-checked out branch. |
Gitk | Look for the green box with the boldfaced name inside. This indicates the current branch. |
The command line | Type:
git branch and you will see all of the branches. dev/12.4.0 *master The current branch will have an * in front of it. |