aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElena ``of Valhalla'' Grandi <valhalla@trueelena.org>2012-11-17 22:03:35 +0100
committerElena ``of Valhalla'' Grandi <valhalla@trueelena.org>2012-11-17 22:03:35 +0100
commitc1745a223e8b96467ab635af0acedc3ba1cb2dcb (patch)
tree6f2ef35764959465189f6d6419b25aa7c334099f
parent59254b3d9135cec613c6477d8a3ae0db91acf98e (diff)
Alcune slide + handout
-rw-r--r--introduzione_a_git.rest125
1 files changed, 121 insertions, 4 deletions
diff --git a/introduzione_a_git.rest b/introduzione_a_git.rest
index f866f78..000fa44 100644
--- a/introduzione_a_git.rest
+++ b/introduzione_a_git.rest
@@ -131,13 +131,12 @@ Altre mod
# modified: greeter/__init__.py
#
-
-Commit
-------
+Ultimi preparativi
+------------------
.. class:: handout
- Finalmente possiamo aggiungere anche le ultime modifiche:
+ A questo punto possiamo aggiungere anche le ultime modifiche:
::
@@ -155,6 +154,9 @@ Commit
$ git config --global user.name "Elena ``of Valhalla'' Grandi"
$ git config --global user.email valhalla@trueelena.org
+Commit
+------
+
.. class:: handout
E finalmente possiamo creare il nostro primo commit, un insieme
@@ -197,6 +199,11 @@ Commit
LOG
---
+.. class:: handout
+
+ Con il comando ``git log`` possiamo vedere l'identificativo
+ completo del commit appena fatto, e qualche metadato.
+
::
$ git log
@@ -206,11 +213,42 @@ LOG
Skeleton for the new project.
+.. class:: handout
+
+ E con ``git show`` possiamo vedere i dettagli del commit, con
+ tutte le modifiche che sono state introdotte (sotto forma
+ di diff dalla versione precedente).
+ Possiamo vedere come non serva scrivere tutto l'identificativo
+ del commit, ma bastino i primi caratteri sufficienti ad
+ identificarlo univocamente nel repository.
+
+::
+
+ $ git show b54e
+ commit b54e94fde972281ca31a56ef0d36204addd4906b
+ Author: Elena ``of Valhalla'' Grandi <valhalla@trueelena.org>
+ Date: Thu Nov 15 19:05:42 2012 +0100
+
+ Skeleton for the new project.
+
+ diff --git a/greeter.py b/greeter.py
+ new file mode 100755
+ index 0000000..b96deee
+ --- /dev/null
+ +++ b/greeter.py
+ @@ -0,0 +1,6 @@
+ +#!/usr/bin/env python
+ +
+ [...]
Iniziamo a lavorarci
--------------------
+.. class:: handout
+
+ Iniziamo a lavorare al progetto, riempiendo qualche file.
+
``greeter/greeter.py``::
class Greeter:
@@ -234,6 +272,16 @@ Iniziamo a lavorarci
Diamo in pasto a git
--------------------
+.. class:: handout
+
+ E vediamo di nuovo il workflow quotidiano: aggiungiamo le modifiche
+ fatte alla staging area con ``git add`` per poi darle in pasto
+ a ``git commit``.
+
+ In questo caso anziché usare un editor per descrivere il commit
+ ci accontentiamo di una descrizione breve, passata per comodità
+ con l'opzione ``-m``.
+
::
$ git add greeter.py greeter/greeter.py
@@ -256,9 +304,78 @@ Diamo in pasto a git
Skeleton for the new project.
+amend
+-----
+
+.. class:: handout
+
+ Se ci si è accorti di aver sbagliato qualcosa nella descrizione
+ del commit lo si può cambiare con ``git commit --amend``.
+
+::
+
+ $ git commit --amend
+
+::
+
+ Generic greetings.
+
+ # Please enter the commit message for your changes. Lines starting
+ # with '#' will be ignored, and an empty message aborts the commit.
+ # On branch master
+ # Changes to be committed:
+ # (use "git reset HEAD^1 <file>..." to unstage)
+ #
+ # modified: greeter.py
+ # modified: greeter/greeter.py
+
+::
+
+ [master 8cdccd9] Generic greetings.
+ 2 files changed, 8 insertions(+), 1 deletion(-)
+
+.. class:: handout
+
+ Notare come l'identificativo del commit sia cambiato: di fatto
+ ``git commit --amend`` cancella l'ultimo commit e ne crea
+ uno nuovo.
+
+ Questo significa che questo comando non si può usare nel caso
+ in cui si sia già distribuito in qualche modo il commit in questione,
+ dato che la cosa può causare problemi negli altri repository.
+
gitignore
---------
+.. class:: handout
+
+ Lavorando al progetto capita che si generino file che si vogliono
+ ignorare, ad esempio i risultati di compilazione: basta aggiungerli
+ al file ``.gitignore`` perché non vengano considerati.
+
+::
+
+ $ ./greeter.py
+ Hello World!
+ $ git status
+ # On branch master
+ # Untracked files:
+ # (use "git add <file>..." to include in what will be committed)
+ #
+ # greeter/__init__.pyc
+ # greeter/greeter.pyc
+ nothing added to commit but untracked files present (use "git add" to track)
+ $ echo "*.pyc" >> .gitignore
+ $ git status
+ # On branch master
+ # Untracked files:
+ # (use "git add <file>..." to include in what will be committed)
+ #
+ # .gitignore
+ nothing added to commit but untracked files present (use "git add" to track)
+ $ git add .gitignore
+ $ git commit -m '.gitignore: ignore .pyc files.'
+
Aggiungere funzionalità
-----------------------