mirror of
https://github.com/git-learning-game/oh-my-git.git
synced 2024-11-20 16:20:18 +01:00
config level, clone level, PR level
This commit is contained in:
parent
8a86009e2f
commit
023a98cfae
8 changed files with 110 additions and 2 deletions
20
levels/intro/clone
Normal file
20
levels/intro/clone
Normal file
|
@ -0,0 +1,20 @@
|
|||
title = Cloning a repo
|
||||
cards = clone commit-auto pull push
|
||||
|
||||
[description]
|
||||
|
||||
Get your friend's repo using clone, change something, push it back.
|
||||
|
||||
[setup]
|
||||
|
||||
rm -rf .git
|
||||
|
||||
[setup friend]
|
||||
|
||||
echo hi > file
|
||||
git add .
|
||||
git commit -m "Initial commit"
|
||||
|
||||
[win friend]
|
||||
|
||||
test "$(git show main:file)" != hi
|
23
levels/intro/who-are-you
Normal file
23
levels/intro/who-are-you
Normal file
|
@ -0,0 +1,23 @@
|
|||
title = Nice to meet you!
|
||||
cards = config-name config-email
|
||||
|
||||
[description]
|
||||
|
||||
Introduce yourself using
|
||||
|
||||
git config --global user.name Firstname
|
||||
git config --global user.email "your@mail.com"
|
||||
|
||||
[setup]
|
||||
|
||||
[actions]
|
||||
|
||||
test "$(git config user.name)" != "You" && hint "Hey $(git config user.name), nice to meet you!"
|
||||
|
||||
[win]
|
||||
|
||||
# Have a name configured.
|
||||
test "$(git config user.name)" != "You"
|
||||
|
||||
# Have an email address configured.
|
||||
test "$(git config user.email)" != "you@time.agency"
|
18
levels/workflows/gitignore
Normal file
18
levels/workflows/gitignore
Normal file
|
@ -0,0 +1,18 @@
|
|||
title = Ignoring files
|
||||
|
||||
[description]
|
||||
|
||||
That chicken is running around a lot, and changing often. We don't want to have it in our commits.
|
||||
|
||||
Add it to the file .gitignore, and try using `git add .`!
|
||||
|
||||
[setup]
|
||||
|
||||
touch .gitignore
|
||||
echo important > important
|
||||
git add important
|
||||
git commit -m "Initial commit"
|
||||
|
||||
[actions]
|
||||
|
||||
echo "$RANDOM" > chicken
|
25
levels/workflows/pr
Normal file
25
levels/workflows/pr
Normal file
|
@ -0,0 +1,25 @@
|
|||
title = Cloning a repo
|
||||
cards = clone commit-auto reset-hard checkout file-new branch
|
||||
|
||||
[description]
|
||||
|
||||
Your friend has a problem! Clone the repo, create a branch called "solution", and fix the problem in this branch. When you're ready, make a "Pull Request" by using `git tag pr`.
|
||||
|
||||
[setup]
|
||||
|
||||
rm -rf .git
|
||||
|
||||
[setup friend]
|
||||
|
||||
echo "2 + 3 = " > file
|
||||
git add .
|
||||
git commit -m "Initial commit"
|
||||
|
||||
[actions friend]
|
||||
|
||||
git ls-remote yours | grep pr && git fetch yours && git merge yours/solution
|
||||
git show main:file | grep 5 && hint "Thanks!"
|
||||
|
||||
[win friend]
|
||||
|
||||
git show main:file | grep 5
|
|
@ -4,6 +4,21 @@
|
|||
"command": "git init",
|
||||
"description": "Initialize the time machine!"
|
||||
},
|
||||
{
|
||||
"id": "clone",
|
||||
"command": "git clone ../[remote] .",
|
||||
"description": "Create your own copy of your friend's repo."
|
||||
},
|
||||
{
|
||||
"id": "config-name",
|
||||
"command": "git config --global user.name [string]",
|
||||
"description": "Set your name."
|
||||
},
|
||||
{
|
||||
"id": "config-email",
|
||||
"command": "git config --global user.email [string]",
|
||||
"description": "Set your email address."
|
||||
},
|
||||
{
|
||||
"id": "checkout",
|
||||
"command": "git checkout [commit, ref]",
|
||||
|
|
|
@ -118,7 +118,7 @@ func move_back():
|
|||
func dropped_on(other):
|
||||
if "[" in command:
|
||||
var argument
|
||||
if other.type == "file":
|
||||
if other.type == "file" or other.type == "remote":
|
||||
argument = other.label
|
||||
else:
|
||||
argument = other.id
|
||||
|
|
|
@ -10,6 +10,8 @@ export var path: String setget set_path, get_path
|
|||
export var simplified_view = true setget set_simplified_view
|
||||
export var editable_path = false setget set_editable_path
|
||||
|
||||
var type = "remote"
|
||||
|
||||
var node = preload("res://scenes/node.tscn")
|
||||
|
||||
var shell = Shell.new()
|
||||
|
@ -74,6 +76,7 @@ func set_label(new_label):
|
|||
if label_node:
|
||||
if new_label == "yours":
|
||||
new_label = ""
|
||||
$Rows/RepoVis/DropArea.queue_free()
|
||||
label_node.text = new_label
|
||||
|
||||
func random_position():
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
[gd_scene load_steps=4 format=2]
|
||||
[gd_scene load_steps=5 format=2]
|
||||
|
||||
[ext_resource path="res://scenes/repository.gd" type="Script" id=1]
|
||||
[ext_resource path="res://styles/theme.tres" type="Theme" id=2]
|
||||
[ext_resource path="res://fonts/big.tres" type="DynamicFont" id=3]
|
||||
[ext_resource path="res://scenes/drop_area.tscn" type="PackedScene" id=4]
|
||||
|
||||
[node name="Repository" type="Control"]
|
||||
anchor_right = 1.0
|
||||
|
@ -30,6 +31,9 @@ __meta__ = {
|
|||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="DropArea" parent="Rows/RepoVis" instance=ExtResource( 4 )]
|
||||
position = Vector2( 67.3194, 32.6666 )
|
||||
|
||||
[node name="Label" type="Label" parent="Rows/RepoVis"]
|
||||
margin_left = 5.60091
|
||||
margin_top = -0.518692
|
||||
|
|
Loading…
Reference in a new issue