Dies ist eine alte Version des Dokuments!


GIT

Zubeginn ist alles leer (Working directory & Index):

$ git status
# On branch master
#
# Initial commit
#
nothing to commit (create/copy files and use "git add" to track)
$ git ls-files --debug -s

Anlegen eines zweier files, wovon eins in den Index kommt (stage)

$ touch unused
$ touch foo
$ git add foo
$ git commit -a -m "Added foo"
[master (root-commit) 5f3450e] Added foo
 0 files changed
 create mode 100644 foo
$ git status
# On branch master
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#	unused
nothing added to commit but untracked files present (use "git add" to track)
$ git ls-files --debug -s
100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0	foo
  ctime: 1354306311:692664264
  mtime: 1354306311:692664264
  dev: 28	ino: 119763
  uid: 1000	gid: 1000
  size: 0	flags: 0

foo touchen, aber nicht den Inhalt verändern

$ touch foo

Keine Änderung wird erkannt & Neue m-time:

$ git status
# On branch master
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#	unused
nothing added to commit but untracked files present (use "git add" to track)
$ git ls-files --debug -s
100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0	foo
  ctime: 1354306421:958755979
  mtime: 1354306421:958755979
  dev: 28	ino: 119763
  uid: 1000	gid: 1000
  size: 0	flags: 0

foo touchen & Inhalt verändern:

$ echo "content" > foo

Änderung erkannt & m-time bleibt alt:

$ git status
# On branch master
# Changes not staged for commit:
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#
#	modified:   foo
#
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#	unused
no changes added to commit (use "git add" and/or "git commit -a"):
$ git ls-files --debug -s
100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0	foo
  ctime: 1354306421:958755979
  mtime: 1354306421:958755979
  dev: 28	ino: 119763
  uid: 1000	gid: 1000
  size: 0	flags: 0

foo In den Index hinzufügen (stagen):

$ git add foo

Änderungen übernommen (neue SHA1) & neue m-time:

$ git status
# On branch master
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#	modified:   foo
#
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#	unused
$ git ls-files --debug -s
100644 d95f3ad14dee633a758d2e331151e950dd13e4ed 0	foo
  ctime: 1354306489:705068567
  mtime: 1354306489:705068567
  dev: 28	ino: 119763
  uid: 1000	gid: 1000
  size: 8	flags: 0

Committen:

$ git commit -a -m "Modified foo"
[master fc724cf] Modified foo
 1 file changed, 1 insertion(+)

Index bleibt unverändert:

$ git status
# On branch master
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#	unused
nothing added to commit but untracked files present (use "git add" to track)
$ git ls-files --debug -s
100644 d95f3ad14dee633a758d2e331151e950dd13e4ed 0	foo
  ctime: 1354306489:705068567
  mtime: 1354306489:705068567
  dev: 28	ino: 119763
  uid: 1000	gid: 1000
  size: 8	flags: 0
misc/git.1354308112.txt.gz · Zuletzt geändert: 2012/11/30 21:41 von 84.56.1.83