From 3c7136d871ca13058d728aed65485a99d857b5be Mon Sep 17 00:00:00 2001 From: Elena ``of Valhalla'' Grandi Date: Thu, 15 Nov 2012 19:19:26 +0100 Subject: Esempi di uso per alcune slide --- introduzione_a_git.rest | 224 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 224 insertions(+) create mode 100644 introduzione_a_git.rest diff --git a/introduzione_a_git.rest b/introduzione_a_git.rest new file mode 100644 index 0000000..0fde3fa --- /dev/null +++ b/introduzione_a_git.rest @@ -0,0 +1,224 @@ +Introduzione a GIT +================== + +.. footer:: LIFO + +.. contents:: + :class: handout + +Un nuovo progetto +----------------- + +:: + + $ mkdir greeter + $ cd greeter/ + $ git init + Initialized empty Git repository in /home/[...]/greeter/.git/ + +Qualche file +------------ + +:: + + $ mkdir greeter + $ touch greeter/__init__.py + $ cat > greeter/greeter.py + class Greeter: + """ """ + $ cat > greeter.py + #!/usr/bin/env python + + def main(): + pass + + if __name__ == '__main__': main() + $ chmod 755 greeter.py + + +GIT +--- + +:: + + $ git status + # On branch master + # + # Initial commit + # + # Untracked files: + # (use "git add ..." to include in what will be committed) + # + # greeter.py + # greeter/ + nothing added to commit but untracked files present (use "git add" to track) + + +In staging +---------- + +:: + + $ git add greeter.py greeter/ + $ git status + # On branch master + # + # Initial commit + # + # Changes to be committed: + # (use "git rm --cached ..." to unstage) + # + # new file: greeter.py + # new file: greeter/__init__.py + # new file: greeter/greeter.py + # + +Altre mod +--------- + +:: + + $ cat > greeter/__init__.py + from greeter import Greeter + $ git status + # On branch master + # + # Initial commit + # + # Changes to be committed: + # (use "git rm --cached ..." to unstage) + # + # new file: greeter.py + # new file: greeter/__init__.py + # new file: greeter/greeter.py + # + # Changes not staged for commit: + # (use "git add ..." to update what will be committed) + # (use "git checkout -- ..." to discard changes in working directory) + # + # modified: greeter/__init__.py + # + + +Commit +------ + +:: + + $ git add greeter/__init__.py + $ git commit + + +:: + + Skeleton for the new project. + # Please enter the commit message for your changes. Lines starting + # with '#' will be ignored, and an empty message aborts the commit. + # On branch master + # + # Initial commit + # + # Changes to be committed: + # (use "git rm --cached ..." to unstage) + # + # new file: greeter.py + # new file: greeter/__init__.py + # new file: greeter/greeter.py + # + +:: + + ".git/COMMIT_EDITMSG" 14L, 377C written + [master (root-commit) b54e94f] Skeleton for the new project. + 3 files changed, 9 insertions(+) + create mode 100755 greeter.py + create mode 100644 greeter/__init__.py + create mode 100644 greeter/greeter.py + + +LOG +--- + +:: + + $ git log + commit b54e94fde972281ca31a56ef0d36204addd4906b + Author: Elena ``of Valhalla'' Grandi + Date: Thu Nov 15 19:05:42 2012 +0100 + + Skeleton for the new project. + + + +Iniziamo a lavorarci +-------------------- + +``greeter/greeter.py``:: + + class Greeter: + """ """ + + def greet(self): + print "Hello World!" + +``greeter.py``:: + + #!/usr/bin/env python + + import greeter + + def main(): + grt = greeter.Greeter() + grt.greet() + + if __name__ == '__main__': main() + +Diamo in pasto a git +-------------------- + +:: + + $ git add greeter.py greeter/greeter.py + $ git commit -m 'Generic greetings' + [master adfbc73] Generic greetings + 2 files changed, 8 insertions(+), 1 deletion(-) + $ git status + # On branch master + nothing to commit (working directory clean) + $ git log + commit adfbc7340ac1af8b1dc80ebb1526c7b2b9ad4d1f + Author: Elena ``of Valhalla'' Grandi + Date: Thu Nov 15 19:08:29 2012 +0100 + + Generic greetings + + commit b54e94fde972281ca31a56ef0d36204addd4906b + Author: Elena ``of Valhalla'' Grandi + Date: Thu Nov 15 19:05:42 2012 +0100 + + Skeleton for the new project. + + + + +Finalmente pubblichiamo +----------------------- + +:: + + $ $BROWSER http://gitorious.org + +Non github? +----------- + +Alternative: + +* _ +* gitolite_ + gitweb_ self-hosted +* ... + +.. _gitolite: +.. _gitweb: + +.. + vim: set filetype=rst: -- cgit v1.2.3