Tutorial Git Branch: Difference between revisions

From HaFrWiki42
Jump to navigation Jump to search
Line 45: Line 45:
== See also ==
== See also ==
<span class="editsection">[[#content|top]]</span>
<span class="editsection">[[#content|top]]</span>
* [[Git]], General on Git
* [[GitHub]], General on GitHub
* [[Tutorial Git Add]], Tutorial on 'git add'.
* [[Tutorial Git Commit]], Tutorial on '''git commit'''.
* [[Tutorial Git Diff]], Tutorial on 'git diff'


== Reference ==
== Reference ==

Revision as of 15:52, 10 July 2017

Introduction

Setup

Setup a new repo with the initial data.

<syntaxhighlight lang="bash"> $ mkdir gitbranch $ cd gitbranch

  1. Initialize git.

$ git init Initialized empty Git repository in /Test/gitbranch/.git/

  1. 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
  1. 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">

  1. Creating the new branch

$ git branch newImage

  1. 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

top

Reference

top