Skip to content

Commit 775b768

Browse files
committed
Add challenge around "git push"
Closes #166. This lesson has few challenges, so this issue seemed like a good opportunity to add one.
1 parent 7f0ab6b commit 775b768

1 file changed

Lines changed: 30 additions & 0 deletions

File tree

episodes/03-sharing.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,36 @@ To https://github.com/<your_github_username>/hello-world
394394

395395
And let's check on GitHub that we now have 2 commits there.
396396

397+
::::::::::::::::::::::::::::::::: challenge
398+
399+
## Challenge: Two different push commands
400+
401+
The first time we pushed our changes, we used a longer command:
402+
403+
```bash
404+
$ git push -u origin main
405+
```
406+
407+
The second time, we used a shorter command:
408+
409+
```bash
410+
$ git push
411+
```
412+
413+
Why didn't we use the same command both times?
414+
415+
::::::::::::::::: solution
416+
417+
The first time, Git didn't know where to push the changes, so we had to tell it the destination to use.
418+
We also used the `-u` flag to tell Git to remember that decision.
419+
420+
The second time, Git knew a destination it could use, so we didn't specify one;
421+
not only did we save on typing, we also avoided worries about typing the wrong destination.
422+
423+
::::::::::::::::::::::::::
424+
425+
:::::::::::::::::::::::::::::::::::::::::::
426+
397427
## Pulling changes
398428

399429
When working with others, or when we're making our own changes from different machines, we need a way of pulling those

0 commit comments

Comments
 (0)