aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElena ``of Valhalla'' Grandi <valhalla@trueelena.org>2012-11-19 18:06:40 +0100
committerElena ``of Valhalla'' Grandi <valhalla@trueelena.org>2012-11-19 18:06:40 +0100
commit488fe0c40b487979b61716138ff24d2931e134e8 (patch)
tree103b83fa35e753a3d506791dbced5b51b26d9082
parentb639105837e6f8a23dd548e2d871649347c297e0 (diff)
Some slides
-rw-r--r--images/gitk01.pngbin0 -> 9468 bytes
-rw-r--r--images/gitk02.pngbin0 -> 8507 bytes
-rw-r--r--images/gitk03.pngbin0 -> 7776 bytes
-rw-r--r--images/gitk04.pngbin0 -> 7430 bytes
-rw-r--r--introduzione_a_git.rest223
5 files changed, 222 insertions, 1 deletions
diff --git a/images/gitk01.png b/images/gitk01.png
new file mode 100644
index 0000000..7feedf9
--- /dev/null
+++ b/images/gitk01.png
Binary files differ
diff --git a/images/gitk02.png b/images/gitk02.png
new file mode 100644
index 0000000..a33befd
--- /dev/null
+++ b/images/gitk02.png
Binary files differ
diff --git a/images/gitk03.png b/images/gitk03.png
new file mode 100644
index 0000000..c2ae4b3
--- /dev/null
+++ b/images/gitk03.png
Binary files differ
diff --git a/images/gitk04.png b/images/gitk04.png
new file mode 100644
index 0000000..22ecfd1
--- /dev/null
+++ b/images/gitk04.png
Binary files differ
diff --git a/introduzione_a_git.rest b/introduzione_a_git.rest
index 533b0b5..a9d8e6a 100644
--- a/introduzione_a_git.rest
+++ b/introduzione_a_git.rest
@@ -493,16 +493,237 @@ Ora di rientrare
::
$git push
+ $ git push
+ Counting objects: 5, done.
+ Delta compression using up to 2 threads.
+ Compressing objects: 100% (3/3), done.
+ Writing objects: 100% (3/3), 487 bytes, done.
+ Total 3 (delta 0), reused 0 (delta 0)
+ Unpacking objects: 100% (3/3), done.
+ remote: error: refusing to update checked out branch: refs/heads/people
+ remote: error: By default, updating the current branch in a non-bare repository
+ remote: error: is denied, because it will make the index and work tree inconsistent
+ remote: error: with what you pushed, and will require 'git reset --hard' to match
+ remote: error: the work tree to HEAD.
+ remote: error:
+ remote: error: You can set 'receive.denyCurrentBranch' configuration variable t
+ remote: error: 'ignore' or 'warn' in the remote repository to allow pushing int
+ remote: error: its current branch; however, this is not recommended unless you
+ remote: error: arranged to update its work tree to match what you pushed in som
+ remote: error: other way.
+ remote: error:
+ remote: error: To squelch this message and still keep the default behaviour, se
+ remote: error: 'receive.denyCurrentBranch' configuration variable to 'refuse'.
+ To /home/[...]/greeter/
+ ! [remote rejected] people -> people (branch is currently checked out)
+ error: failed to push some refs to '/home/[...]/greeter/'
.. class:: handout
- C'è un problema:
+ C'è un problema: git non permette di fare push che dovrebbero modificare
+ ciò che c'è nella *working copy* dell'altro repository; una soluzione
+ sarebbe richiedere l'aggiornamento con il comando ``git pull``
+ dal repository sul PC, ma richiede un po' di configurazione.
+ Per ora usiamo una soluzione veloce:
+
+::
+
+ $ cd /home/[...]/greeter/
+ $ git checkout master
+ $ cd -
+ $USB_KEY/greeter
+ $ git push
+ Counting objects: 5, done.
+ Delta compression using up to 2 threads.
+ Compressing objects: 100% (3/3), done.
+ Writing objects: 100% (3/3), 487 bytes, done.
+ Total 3 (delta 0), reused 0 (delta 0)
+ Unpacking objects: 100% (3/3), done.
+ To /home/[...]/greeter/
+ d78d340..59b9d39 people -> people
+ $ git log
+ commit 59b9d3971db8cb872c798b215365b22fb20aa5a7
+ [...]
+ $ cd /home/[...]/greeter/
+ $ git checkout people
+ Switched to branch 'people'
+ $ git log
+ commit 59b9d3971db8cb872c798b215365b22fb20aa5a7
+
+Bugfixing della versione stabile
+--------------------------------
+
+.. class:: handout
+
+ Qualcuno ci fa notare che nella versione "stabile" del nostro programma
+ c'è un errore: una riga di documentazione vuota. Rimediamo subito!
+
+::
+
+ $ git checkout master
+ Switched to branch 'master'
+
+``greeter/greeter.py``::
+
+ class Greeter:
+ """This class greets people."""
+
+ def greet(self):
+ print "Hello World!"
+
+::
+
+ $ git add greeter/greeter.py
+ $ git commit -m 'greeter/greeter.py: docstring for the class'
+ [master cdef61b] greeter/greeter.py: docstring for the class
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
Reintegriamo in master
----------------------
.. class:: handout
+ Adesso che la funzionalità è completa possiamo reintegrarla nel branch
+ master: con ``gitk -a`` possiamo vedere la situazione attuale.
+
+::
+
+ $ git checkout people
+ Switched to branch 'people'
+ $ gitk -a
+
+.. figure:: images/gitk01.png
+ :align: left
+
+.. class:: handout
+
+ Notiamo che al momento il branch people parte da un commit di master
+ che non è l'ultimo: questo non è un problema per riportarlo in master,
+ ma causa un commit fittizio con il quale si descrive il merge.
+
+ Dato che il branch people non è stato pubblicato da nessuna parte,
+ possiamo invece barare e portarlo a nascere dall'ultimo commit di master.
+
+::
+
+ $ git log
+ commit 59b9d3971db8cb872c798b215365b22fb20aa5a7
+ [...]
+ commit d78d34010156781d20ef194a62f00d4eb9edb26b
+ $ git rebase master
+ First, rewinding head to replay your work on top of it...
+ Applying: greeter/greeter.py: support for multiple greetees
+ Using index info to reconstruct a base tree...
+ Falling back to patching base and 3-way merge...
+ Auto-merging greeter/greeter.py
+ Applying: greeter.py: support for a custom greetee.
+ $ git log
+ commit 5a23f44b8492f41f6a4834b959111b924efa905c
+ [...]
+ commit 2229a1833b2dd00922978140d5b7e16688408ee1
+ $ gitk -a
+
+.. figure:: images/gitk01.png
+ :align: left
+
+.. class:: handout
+
+ I commit hanno cambiato identificativo, non sono più gli stessi di prima,
+ ma almeno possiamo vedere che il nostro branch è la prosecuzione
+ naturale di master.
+
+ Già che ci siamo, però, possiamo decidere che i due commit riguardano
+ la stessa modifica, per cui possiamo unirli in un commit solo.
+
+::
+
+ $ git rebase -i master
+
+::
+
+ pick 2229a18 greeter/greeter.py: support for multiple greetees
+ squash 5a23f44 greeter.py: support for a custom greetee.
+
+ # Rebase cdef61b..5a23f44 onto cdef61b
+ #
+ # Commands:
+ # p, pick = use commit
+ # r, reword = use commit, but edit the commit message
+ # e, edit = use commit, but stop for amending
+ # s, squash = use commit, but meld into previous commit
+ # f, fixup = like "squash", but discard this commit's log message
+ # x, exec = run command (the rest of the line) using shell
+ #
+ # These lines can be re-ordered; they are executed from top to bottom.
+ #
+ # If you remove a line here THAT COMMIT WILL BE LOST.
+ # However, if you remove everything, the rebase will be aborted.
+ #
+
+::
+
+ Support for a custom greetee.
+ # This is a combination of 2 commits.
+ # The first commit's message is:
+
+ # This is the 2nd commit message:
+
+ # Please enter the commit message for your changes. Lines starting
+ # with '#' will be ignored, and an empty message aborts the commit.
+ #
+ # Author: Elena of Valhalla'' Grandi <valhalla@trueelena.org>
+ #
+ # Not currently on any branch.
+ # Changes to be committed:
+ # (use "git reset HEAD <file>..." to unstage)
+ #
+ # modified: greeter.py
+ # modified: greeter/greeter.py
+ #
+
+::
+
+ ".git/COMMIT_EDITMSG" 18L, 509C written
+ [detached HEAD ca91dc9] Support for a custom greetee.
+ Author: Elena of Valhalla'' Grandi <valhalla@trueelena.org>
+ 2 files changed, 8 insertions(+), 3 deletions(-)
+ Successfully rebased and updated refs/heads/people.
+
+
+
+.. class:: handout
+
+ A questo punto il nostro branch è pronto per essere reinserito in
+ master.
+
+::
+
+ $ git log
+ commit ca91dc9944e003ff47ec58464f3ebbb2ffdb8cfa
+ [...]
+ $ gitk -a
+
+.. figure:: images/gitk03.png
+ :align: left
+
+::
+
+ $ git checkout master
+ Switched to branch 'master'
+ $ git merge people
+ Updating cdef61b..ca91dc9
+ Fast-forward
+ greeter.py | 7 ++++++-
+ greeter/greeter.py | 4 ++--
+ 2 files changed, 8 insertions(+), 3 deletions(-)
+ $ git branch -d people
+ Deleted branch people (was ca91dc9).
+ $ gitk -a
+
+.. figure:: images/gitk04.png
+ :align: left
+
Un bel backup
-------------