Skip to content

Commit d8fdc0d

Browse files
authored
Merge pull request #152 from FAIR2-for-research-software/ns-rse/configure-nano
2 parents 7eae593 + dd0e8f7 commit d8fdc0d

File tree

1 file changed

+17
-12
lines changed

1 file changed

+17
-12
lines changed

episodes/introduction.md

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,8 @@ typically you don't need to change this, just hit `Enter`.
229229

230230
When done editing you need to exit and return to the command line, you do this with `Ctrl + x`.
231231

232+
::::::::::::::::::::::::::::::::::::: callout
233+
232234
#### Useful alias
233235

234236
You may want to set the following alias in your `~/.bashrc` file, it sets various options. You can then `source
@@ -241,6 +243,8 @@ echo "alias nano='nano --autoindent --linenumbers --tabstospaces --tabsize=4'" >
241243

242244
These options will be used whenever you use `nano`. See more options with `nano --help`
243245

246+
::::::::::::::::::::::::::::::::::::::::::::::::
247+
244248
## Git Configuration
245249

246250
Git configuration comes in two forms, "global" and "local" and is courtesy of some simple text files. The global
@@ -303,7 +307,7 @@ You can always lookup the location of configuration options using the following
303307
configuration is set as the first column of output.
304308

305309
``` bash
306-
git config --list --show-origin --show-scope
310+
git config --list --show-scope --show-origin
307311

308312
```
309313

@@ -327,16 +331,14 @@ chronological order when you `git branch --list`.
327331

328332
## Challenge 1
329333

330-
Add the fields `user` and `email` to the `github` section of your global configuration setting them to your GitHub
331-
username and your registered email address.
334+
Set globally the default editor to be `nano` (**Hint** this is nested under the `core` options).
332335

333336
:::::::::::::::::::::::: solution
334337

335338
## Solution 1 - Command Line
336339

337340
``` bash
338-
git config --global github.user ns-rse
339-
git config --global github.email n.shephard@sheffield.ac.uk
341+
git config --global core.editor nano
340342
```
341343

342344
:::::::::::::::::::::::::::::::::
@@ -347,9 +349,8 @@ git config --global github.email n.shephard@sheffield.ac.uk
347349
You could alternatively edit the `~/.gitconfig` file directly and add the following lines
348350

349351
``` bash
350-
[github]
351-
user = ns-rse
352-
email = n.shephard@sheffield.ac.uk
352+
[core]
353+
editor = nano
353354
```
354355

355356
:::::::::::::::::::::::::::::::::
@@ -376,21 +377,25 @@ As with other configuration options you can also edit the configuration files di
376377

377378
::::::::::::::::::::::::::::::::::::: challenge
378379

379-
## Challenge 2 - Set a   `git log` alias
380+
## Challenge 2 - Set a   `git log`   alias
380381

381382
`git log` shows the history of commits on the current branch, but its default is quite verbose. Fortunately there are a
382383
_lot_ of options to modify the output adding colour, shortening dates and including a graph and we've been using a
383384
version a fair bit already. You can see all the options in the manual ([`git log --help`][gitlog])
384385

385-
Rather than having to remember this long complicated command or rely on your shell history you can instead set an alias.
386+
Rather than having to remember all the options and type them out each time you can set an alias that stores the options
387+
you want and can be called instead.
386388

387-
For this exercise add the following set of log options to an alias of your choice (this course uses `logp` but you are
388-
free to set it to whatever you want, e.g. `lp`)
389+
For this exercise add the following set of log options to a global alias of your choice (the solution uses `logp` but
390+
you are free to set it to whatever you want, e.g. `lp`)
389391

390392
``` bash
391393
log --graph --pretty=format:"%C(yellow)%h\\ %C(green)%ad%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=short
392394
```
393395

396+
**NB** - Because there are double-quotes in this command you will if using the command line solution have to enclose all
397+
of the above in single quotes.
398+
394399
:::::::::::::::::::::::: solution
395400

396401
## Solution 1 - Edit   `~/.gitconfig`

0 commit comments

Comments
 (0)