Merge remote-tracking branch 'origin/main' into main

This commit is contained in:
bleeptrack 2021-01-14 11:44:50 +01:00
commit 8de8494677
18 changed files with 733 additions and 19 deletions
levels/unused

35
levels/unused/fetch Normal file
View file

@ -0,0 +1,35 @@
title = Fetching from remotes
cards = checkout fetch commit-auto
[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

26
levels/unused/index-mv Normal file
View file

@ -0,0 +1,26 @@
title = Rename a file in the next commit
cards = add reset-file checkout-file mv commit
[description]
Other times, you might want to rename a file in the next commit. Use
git mv [file] [new name]
for that. The effect is very similar as if you had created a copy with a new name, and removed the old version.
[setup]
echo a > a
echo SPECIAL > b
echo x > c
git add .
git commit -m "Initial commit"
echo x > a
echo b >> b
git add b
[win]
# Make a commit where you rename the file b to "x".
test "$(git ls-tree --name-only main)" = "$(echo -e "a\nc\nx")"