61
|
1 |
-*- outline -*-
|
|
2 |
|
|
3 |
* Setup git.
|
|
4 |
|
|
5 |
** Debian.
|
|
6 |
|
|
7 |
For Etch Degian release use git-core package from backports,
|
|
8 |
old 1.4 version of git very dumb compared to new version 1.5.
|
|
9 |
|
|
10 |
$ sudo apt-get install git-core
|
|
11 |
|
|
12 |
After install setup some options:
|
|
13 |
|
|
14 |
$ git config --global user.name "Oleksandr Gavenko"
|
|
15 |
$ git config --global user.mail "gavenkoa@gmail.com"
|
|
16 |
$ cat ~/.gitconfig
|
|
17 |
[user]
|
|
18 |
name = Oleksandr Gavenko
|
|
19 |
mail = gavenkoa@gmail.com
|
|
20 |
|
|
21 |
* Start your project.
|
|
22 |
|
|
23 |
Setup proj space on fs.
|
|
24 |
|
|
25 |
$ mkdir proj
|
|
26 |
$ cd proj
|
|
27 |
$ git init
|
|
28 |
Initialized empty Git repository in /home/user/tmp/proj/.git/
|
|
29 |
$ ls -a
|
|
30 |
. .. .git
|
|
31 |
|
|
32 |
Add file, make changes, commit all.
|
|
33 |
|
|
34 |
$ emacs Makefile
|
|
35 |
... C-x C-c
|
|
36 |
$ emacs app.c
|
|
37 |
... C-x C-c
|
|
38 |
$ git add Makefile app.c
|
|
39 |
$ git status
|
|
40 |
# On branch master
|
|
41 |
#
|
|
42 |
# Initial commit
|
|
43 |
#
|
|
44 |
# Changes to be committed:
|
|
45 |
# (use "git rm --cached <file>..." to unstage)
|
|
46 |
#
|
|
47 |
# new file: Makefile
|
|
48 |
# new file: app.c
|
|
49 |
#
|
|
50 |
|
|
51 |
or just
|
|
52 |
|
|
53 |
$ git add .
|
|
54 |
|
|
55 |
Commit newlly added file:
|
|
56 |
|
|
57 |
$ git commit
|
|
58 |
... Write message log ...
|
|
59 |
Created initial commit 2169263: My first commit massage.
|
|
60 |
1 files changed, 4 insertions(+), 0 deletions(-)
|
|
61 |
create mode 100644 app.c
|
|
62 |
|
|
63 |
* Undo tracking added file.
|
|
64 |
|
|
65 |
You do
|
|
66 |
|
|
67 |
$ git add badfile
|
|
68 |
$ git status
|
|
69 |
# On branch master
|
|
70 |
# Changes to be committed:
|
|
71 |
# (use "git reset HEAD <file>..." to unstage)
|
|
72 |
#
|
|
73 |
# new file: badfile
|
|
74 |
#
|
|
75 |
|
|
76 |
To stop tracking badfile do
|
|
77 |
|
|
78 |
$ git rm --cached badfile
|
|
79 |
$ git status
|
|
80 |
# On branch master
|
|
81 |
# Untracked files:
|
|
82 |
# (use "git add <file>..." to include in what will be committed)
|
|
83 |
#
|
|
84 |
# file
|
|
85 |
nothing added to commit but untracked files present (use "git add" to track)
|
|
86 |
|
|
87 |
or
|
|
88 |
|
|
89 |
$ git reset badfile
|
|
90 |
|
|
91 |
* Doing changes.
|
|
92 |
|
|
93 |
$ printf "clean:\n<TAB>rm $(wildcard *.o)" >>Makefile
|
|
94 |
$ git diff
|
|
95 |
diff --git a/Makefile b/Makefile
|
|
96 |
index e84f7e9..cd2438a 100644
|
|
97 |
--- a/Makefile
|
|
98 |
+++ b/Makefile
|
|
99 |
@@ -1,2 +1,5 @@
|
|
100 |
all:
|
|
101 |
@echo XXX
|
|
102 |
exit 1
|
|
103 |
+
|
|
104 |
+clean:
|
|
105 |
+ rm -f *.o
|
|
106 |
\ No newline at end of file
|
|
107 |
$ git add Makefile
|
|
108 |
$ git commit -m "Added clean target."
|
|
109 |
Created commit 11272b9: Added clean target.
|
|
110 |
1 files changed, 1 insertions(+), 0 deletions(-)
|
|
111 |
create mode 100644 file
|
|
112 |
|
|
113 |
or just
|
|
114 |
|
|
115 |
$ git commit -a -m "Added clean target."
|
|
116 |
|
|
117 |
* Using git to work with SVN offline.
|
|
118 |
|
|
119 |
$ sudo apt-get svn git-core git-svn
|
|
120 |
$
|