nano maketable.sh # open nano# type this:cd ~/houseprices # make sure we are in the right placecut-d'|'-f 18 valeursfoncieres-2023.txt |sort|uniq-c|sort-r|head-n 10# save and exit
(Does it work?)
ls . # check the new file is there./maketable.sh# run it!
Ok, now let’s see what git makes of our additions to this directory.
floswald@PTL11077 ~/houseprices (main)> git statusOn branch mainNo commits yetUntracked files: (use "git add <file>..." to include in what will be committed) valeursfoncieres-2023.txt maketable.sh
It is actually helpful not to use bash as a shell…
Customizing your shell is an extremely effective procrastination device.
You must know what shaving a Yak means before you walk out of my class.
Seeing the Difference
the command git diff shows you what changed between versions.
lets see what it shows now:
$ git diff
It shows nothing, i.e. an empty diff, because there are no commits yet to compare with.
Ok, let’s change that.
Modify-Add-Commit 1
git reports about untracked files. We need to decide what to track.
Move files to staging area:
git add maketable.sh git status
Notice that I did not want to track the csv file.
On branch mainNo commits yetChanges to be committed:(use"git rm --cached <file>..." to unstage)new file: maketable.shUntracked files:(use"git add <file>..." to include in what will be committed)valeursfoncieres-2023.txt
Modify-Add-Commit 2
Now, let’s record what is in the staging area.
$ git commit -m'added the maketable script'[main(root-commit)9956506] added the maketable script1 file changed, 2 insertions(+)create mode 100644 maketable.sh
check status:
$ git statusOn branch mainUntracked files:(use"git add <file>..." to include in what will be committed)valeursfoncieres-2023.txtnothing added to commit but untracked files present (use"git add" to track)➜ gasprices git:(main)✗
Modify-Add-Commit 3
Let’s check what’s in the log.
$ git log commit 9956506dc3159403b87aea3b04654c293e82c680 (HEAD-> main)Author: Florian Oswald <florian.oswald@gmail.com>Date: Tue Feb 7 10:50:51 2023 +0100added the maketable script
Modify-Add-Commit 4
Now let’s modify the script finally.
$ nano maketable.sh# add this line on top echo hello user, will make a contigency table now.# save and exit
now - what’s the difference in the repo?
Diffing
there are still the same files here:
$ ls valeursfoncieres-2023.txt maketable.sh
But we can now compare versions:
$ git diff diff--git a/maketable.sh b/maketable.shindex 7e01058..3b7007e 100644--- a/maketable.sh+++ b/maketable.sh@@-1,2 +1,3 @@+echo hello user, will make a contigency table now.cd ~/valeursfoncieres-2023.txt # make sure we are in the right placecut-d';'-f 5 valeursfoncieres-2023.txt |tr[:lower:][:upper:]|sort|uniq-c|sort