mirror of
https://github.com/git-learning-game/oh-my-git.git
synced 2024-11-13 19:04:54 +01:00
Beginning of remotes chapter
This commit is contained in:
parent
d9a9498277
commit
e6b12b75f7
5 changed files with 95 additions and 0 deletions
33
levels/remotes/add
Normal file
33
levels/remotes/add
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
title = Adding a remote
|
||||||
|
cards = checkout
|
||||||
|
|
||||||
|
[description]
|
||||||
|
|
||||||
|
Let's work together with others! Your friend has their own repo at the URL `../friend` - you can add it using
|
||||||
|
|
||||||
|
git remote add [name] [URL]
|
||||||
|
|
||||||
|
where `[name]` is an arbitrary, short name you pick for the remote.
|
||||||
|
|
||||||
|
When you've done that, you can get all commits from that remote using
|
||||||
|
|
||||||
|
git pull friend
|
||||||
|
|
||||||
|
There's a letter for you!
|
||||||
|
|
||||||
|
[setup]
|
||||||
|
|
||||||
|
git remote remove friend
|
||||||
|
|
||||||
|
[setup friend]
|
||||||
|
|
||||||
|
echo "I'm really committed to our friendship! <3" > love_letter
|
||||||
|
git add .
|
||||||
|
git commit -m "Write a letter"
|
||||||
|
|
||||||
|
[win]
|
||||||
|
|
||||||
|
# Add a remote that points to ../friend.
|
||||||
|
git remote -v | grep '../friend'
|
||||||
|
# Pull from the remote.
|
||||||
|
git show HEAD:love_letter | grep committed
|
35
levels/remotes/fetch
Normal file
35
levels/remotes/fetch
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
title = Fetching from remotes
|
||||||
|
cards = checkout
|
||||||
|
|
||||||
|
[description]
|
||||||
|
|
||||||
|
Here, you already have two remotes configured! You can list them using `git remote`.
|
||||||
|
|
||||||
|
Fetch from both, and look at the suggestions.
|
||||||
|
|
||||||
|
Then, make a new commit on top of your original one that introduces a compromise.
|
||||||
|
|
||||||
|
[setup]
|
||||||
|
|
||||||
|
echo "The bikeshed should be ???" > proposal
|
||||||
|
git add .
|
||||||
|
git commit -m "What do you think?"
|
||||||
|
|
||||||
|
[setup friend1]
|
||||||
|
|
||||||
|
git pull yours main
|
||||||
|
echo "The bikeshed should be green" > proposal
|
||||||
|
git commit -am "Green"
|
||||||
|
|
||||||
|
[setup friend2]
|
||||||
|
|
||||||
|
git pull yours main
|
||||||
|
echo "The bikeshed should be blue" > proposal
|
||||||
|
git commit -am "Blue"
|
||||||
|
|
||||||
|
[win]
|
||||||
|
|
||||||
|
# Your proposal is acceptable for friend1.
|
||||||
|
git show main:proposal | git grep green
|
||||||
|
# Your proposal is acceptable for friend2.
|
||||||
|
git show main:proposal | git grep blue
|
23
levels/remotes/rename-delete
Normal file
23
levels/remotes/rename-delete
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
title = Deleting and renaming a remote
|
||||||
|
cards = checkout
|
||||||
|
|
||||||
|
[description]
|
||||||
|
|
||||||
|
Here, you already have two remotes configured! You can list them using `git remote`.
|
||||||
|
|
||||||
|
[setup]
|
||||||
|
|
||||||
|
git remote rename friend frend
|
||||||
|
|
||||||
|
[setup friend]
|
||||||
|
|
||||||
|
[setup enemy]
|
||||||
|
|
||||||
|
[win]
|
||||||
|
|
||||||
|
# Rename the remote with the typo (using `git remote rename [old name] [new name]`)
|
||||||
|
git remote | grep friend
|
||||||
|
# The remote with the typo is gone.
|
||||||
|
! grep 'frend' <(git remote)
|
||||||
|
# Delete the remote you don't want to keep (using `git remote remove [remote]`)
|
||||||
|
! grep 'enemy' <(git remote)
|
3
levels/remotes/sequence
Normal file
3
levels/remotes/sequence
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
add
|
||||||
|
rename-delete
|
||||||
|
fetch
|
|
@ -1,5 +1,6 @@
|
||||||
stash
|
stash
|
||||||
index
|
index
|
||||||
|
remotes
|
||||||
shit-happens
|
shit-happens
|
||||||
time-machine
|
time-machine
|
||||||
low-level
|
low-level
|
||||||
|
|
Loading…
Reference in a new issue