Module 2 Exercise 3: Wikipedia Switcheroo


(Nathan Eloe) #121

Branching do what branching do! The README in the branch contains both, but the README in master only contains the first planet


(Michael Clausen) #122

The file contains both as master was the actual starting point of the mars branch.


(Christian Nievas) #123


(JagCode) #124

The file on my machine shows my old planet (Neptune). I’m guessing Mercury won’t show until I merge?


(Robert Foreman) #125

It sort of depends on which branch one is currently in. Since we are still in the second branch the second planet shows in the current working file, but if one switches back to the master branch it will be the original planet.


(Pol Benedito Momplet) #126


(Gustavo Freitas) #127


(Lluisgarciapons) #128


(Nietcdf) #129


(Baptiste Pesquet) #130


(Chris Jones) #131

It shows the second planet on the new branch and the first planet on the master branch.


(Konstantin) #132


(Glenn) #133

The file shows the contents (about Jupiter) of the new branch because we are still on that bookmark. If we would switch back to the master branch, the readme.md would contain the Saturn information.


(Jason T. Mickel) #134

master only shows Neptune
jupiter branch contains both


(Patrick Reimers) #135

Both Paragraphs are shown.


(Edward A. Roualdes) #136

Both paragraphs are shown.


(Cfcortesmx) #137

If on master it only shows mars but if on jupiter branch it shows mars & jupiter!


(Héricles Emanuel) #138


(Jlennartz G) #139

jlennartz@JLDesktop MINGW64 ~
$ git init planets
Initialized empty Git repository in C:/Users/jlennartz/planets/.git/

jlennartz@JLDesktop MINGW64 ~
$ cd planets

jlennartz@JLDesktop MINGW64 ~/planets (master)
$ touch readme.md

jlennartz@JLDesktop MINGW64 ~/planets (master)
$ git add readme.md

jlennartz@JLDesktop MINGW64 ~/planets (master)
$ git commit -m ‘add empty readme file’
[master (root-commit) 6d379db] add empty readme file
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 readme.md

jlennartz@JLDesktop MINGW64 ~/planets (master)
$ vi readme.md

jlennartz@JLDesktop MINGW64 ~/planets (master)
$ git status
On branch master
Changes not staged for commit:
(use “git add …” to update what will be committed)
(use “git checkout – …” to discard changes in working directory)

    modified:   readme.md

no changes added to commit (use “git add” and/or “git commit -a”)

jlennartz@JLDesktop MINGW64 ~/planets (master)
$ git commit -a -m ‘added dwarf planet info’
warning: LF will be replaced by CRLF in readme.md.
The file will have its original line endings in your working directory.
[master e67f40c] added dwarf planet info
1 file changed, 3 insertions(+)

jlennartz@JLDesktop MINGW64 ~/planets (master)
$ cat readme.md
A dwarf planet is a planetary-mass object that is neither a true planet nor a natural satellite; it is in direct orbit of a star, and is massive enough for its gravity to compress it into a hydrostatically equilibrious shape (usually a spheroid ), but has not cleared the neighborhood of other material around its orbit.

jlennartz@JLDesktop MINGW64 ~/planets (master)
$ git branch rogue

jlennartz@JLDesktop MINGW64 ~/planets (master)
$ git checkout rogue
Switched to branch ‘rogue’

jlennartz@JLDesktop MINGW64 ~/planets (rogue)
$ vi readme.md

jlennartz@JLDesktop MINGW64 ~/planets (rogue)
$ git commit -a -m ‘added rogue planet info’
warning: LF will be replaced by CRLF in readme.md.
The file will have its original line endings in your working directory.
[rogue c5ba4a0] added rogue planet info
1 file changed, 1 insertion(+)

jlennartz@JLDesktop MINGW64 ~/planets (rogue)
$ cat readme.md
A dwarf planet is a planetary-mass object that is neither a true planet nor a natural satellite; it is in direct orbit of a star, and is massive enough for its gravity to compress it into a hydrostatically equilibrious shape (usually a spheroid ), but has not cleared the neighborhood of other material around its orbit.

A rogue planet (also termed an interstellar planet, nomad planet, free-floating planet, orphan planet, wandering planet, s tarless planet, or sunless planet) is a planetary-mass object that orbits a galactic center directly. Such objects have be en ejected from the planetary system in which they formed or have never been gravitationally bound to any star or brown dw arf.[1][2][3] The Milky Way alone may have billions of rogue planets.

jlennartz@JLDesktop MINGW64 ~/planets (rogue)
$ git checkout master
Switched to branch ‘master’

jlennartz@JLDesktop MINGW64 ~/planets (master)
$ cat readme.md
A dwarf planet is a planetary-mass object that is neither a true planet nor a natural satellite; it is in direct orbit of a star, and is massive enough for its gravity to compress it into a hydrostatically equilibrious shape (usually a spheroid ), but has not cleared the neighborhood of other material around its orbit.

The branch readme has both planet descriptions, whereas the master readme has only the first.


(Paul Inventado) #140

The new branch would contain information about both planets, but the master branch would only have information about the first planet.