Difference between revisions of "Tutorial Git Branch"
m (→Setup) |
m (→Create branch) |
||
Line 29: | Line 29: | ||
== Create branch == | == Create branch == | ||
+ | Now lets create a new branch called ''newImage''. | ||
+ | <syntaxhighlight lang="bash"> | ||
+ | # Creating the new branch | ||
+ | $ git branch newImage | ||
+ | # Prepare to put something into the new branch | ||
+ | $ git commit | ||
+ | $ git branch | ||
+ | * master | ||
+ | newImage | ||
+ | </syntaxhighlight> | ||
+ | Houston we have a problem. We are at branch ''master'' instead of the ''newImage''. | ||
== See also == | == See also == |
Revision as of 17:00, 9 July 2017
Introduction
Setup
Setup a new repo with the initial data.
<syntaxhighlight lang="bash"> $ mkdir gitbranch $ cd gitbranch
- Initialize git.
$ git init Initialized empty Git repository in /Test/gitbranch/.git/
- Creating the initial content
$ echo Original Init Data Master >> data $ git add data $ git commit -m "Introduction" [master (root-commit) 551517e] Introduction
1 file changed, 1 insertion(+) create mode 100644 data
- Check the status
$ git status On branch master nothing to commit, working directory clean </syntaxhighlight>
Create branch
Now lets create a new branch called newImage. <syntaxhighlight lang="bash">
- Creating the new branch
$ git branch newImage
- Prepare to put something into the new branch
$ git commit $ git branch
* master newImage
</syntaxhighlight>
Houston we have a problem. We are at branch master instead of the newImage.