1 #+TITLE: How to use git to edit Worg files?
3 #+EMAIL: mdl AT imapmail DOT org
4 #+STARTUP: align fold nodlcheck hidestars oddeven lognotestate
5 #+SEQ_TODO: TODO(t) INPROGRESS(i) WAITING(w@) | DONE(d) CANCELED(c@)
6 #+TAGS: Write(w) Update(u) Fix(f) Check(c)
10 #+OPTIONS: H:3 num:nil toc:t \n:nil ::t |:t ^:t -:t f:t *:t tex:t d:(HIDE) tags:not-in-toc
12 [[file:index.org][{Back to Worg's index}]]
16 [[http://git.or.cz][git]] is a fast version control system that lets you collaborate on a
17 project. For details on how to use git, go and read the [[http://www.kernel.org/pub/software/scm/git/docs/gittutorial.html][git tutorial]].
18 For details on the public git repository, please check it [[https://code.orgmode.org/bzg/worg][here]].
20 The homepage of the Worg project is here: https://orgmode.org/worg/.
22 To clone a read-only copy of the repo:
24 : ~$ git clone https://code.orgmode.org/bzg/worg.git
26 If you intend to push changes, see below to ask for an account; and,
29 : ~$ git clone git@code.orgmode.org:bzg/worg.git
31 Since Worg is constantly updated you may want to update your copy of
32 Worg before reading sometimes later. To do so =cd= into the Worg
33 directory and upgrade your copy of Worg with the command:
37 If you want to contribute to Worg, keep reading.
39 * The first time you contribute to Worg
41 :CUSTOM_ID: contribute-to-worg
44 1. If you don't have a SSH-key, [[file:worg-git-ssh-key.org][create one]].
46 2. Create an account on https://code.orgmode.org by emailing your
47 requested username to [[mailto:tec@tecosaur.com][Timothy]].
49 3. Add your public key on this account.
51 4. Install =git= on your system. Tell =git= to use your private key with
52 worg by updating =~/.ssh/config= with:
54 : Host code.orgmode.org
55 : HostName code.orgmode.org
56 : IdentityFile ~/.ssh/your-private-ssh-key-file-name
58 5. Clone the project somewhere in a working directory:
60 : ~$ git clone git@code.orgmode.org:bzg/worg.git
62 6. Go to the newly created =worg/= directory and edit some files.
64 7. If you created files, add them to the git index:
68 8. Commit changes with the appropriate comment:
70 : ~$ git commit -a -m "summary comment about all changes"
72 9. Ask =bzg AT gnu.org= to be added as a collaborator on the Worg repo.
74 10. When you are a collaborator, push your change to Worg:
78 The system is designed for immediate updates -- if not, it means
79 something is wrong. You should be able to read the error message
80 and see what is wrong, then help with fixing issues. In general
81 the issues are trivial to fix.
83 * The second time you contribute to Worg
85 1. Go to your =worg/= directory.
87 2. Be sure to "pull" the last version of the repository.
89 : ~$ git pull --rebase
91 3. Make some changes. (If you want to learn more about various git
92 workflow, read [[file:worg-git-advanced.org][this page]].)
94 4. Commit your changes on your local repository:
96 : ~$ git commit -a -m "summary comment about all changes"
98 5. Push your change on the remote repository
106 The Worg TODO file is =worg-todo.org=. If you are a Worg zealot, maybe
107 you want to add this file to the list of your agenda files. For
108 example, here is my =org-agenda-files= variable:
110 : (setq org-agenda-files '("~/org/bzg.org" "~/git/worg/worg-todo.org")
112 I have an agenda custom command for checking tasks that are assigned
115 : (org-add-agenda-custom-command '("W" tags "Owner=\"Bastien\""))
117 The next time someone assigns a task for me, it will appear in my Worg
120 ** Register your changes under your name
122 Information regarding your name can be stored in your global
123 =~/.gitconfig= file, or in =Worg/.git/config=.
128 : name = FirstName LastName
129 : email = you@yourdomain.example.com
131 Now your changes will be filed under your name.
133 # I'm not sure this is useful at all:
135 ** Rebase to avoid merging commits
137 It's good practice to pull the current version of the repository
138 before making your own additions. But even if you do, someone might
139 make a change while you are working. So it will often be necessary to
140 pull immediately before pushing your new commit. In this situation, if
141 you use =git pull= directly, then a 'merge commit' will be generated,
145 commit aaaabbbbbbbbbaaaaaaaaabbbbbbbb
146 Merge: bababa efefefef
147 Author: Some one <name@domain>
148 Date: Wed Nov 24 00:00:01 2010 -0700
150 Merge branch 'master' of git+ssh://repo.or.cz/srv/git/Worg
153 That's not a major problem, but it's nice to keep the commit logs free
154 of this stuff. To avoid generating the merge commit, use the =--rebase=
157 : ~$ git pull --rebase
159 Basically this means that your commit will be put to the top of the
160 stack, as if no one had made any additions while you were
161 working. More advanced git users might make their changes in a
162 personal branch, and then rebase that branch against a freshly pulled
163 master branch before merging it in to master. The end result would be
164 the same as pulling with =--rebase=.
166 ** Dealing with line endings
168 Unix, Windows and Mac all have different conventions for marking the
169 end of a line. This might lead to problems when editing the same file
170 across platforms. Github advises Linux users to automatically convert
171 all external files to LF on committing (see
172 [[http://help.github.com/dealing-with-lineendings]]) by setting:
174 : ~$ git config --global core.autocrlf input
176 For Worg, this is the wrong solution, since there are already files
177 with both end of line conventions in the repository. Instead tell git
178 locally not to convert files by setting:
180 : ~$ git config core.autocrlf false
182 Of course you have to be careful not to save Windows files as Unix
183 files or vice versa, since this would lead to large and confusing
184 diffs. This should not be a problem with Worg as
186 - one rarely edits other people's files anyway, and
187 - Emacs can deal with end of line conventions transparently.
189 ** Git usage for people who just want to send patches
191 See [[file:worg-git-advanced.org][this page]].
193 ** Emacs' in-built version control system and git
195 Emacs's VC supports many common git operations, but others, like
196 repository syncing must be done from the command line. For example
197 the Command =C-x v v= does check in changes in the *local* and not
198 in the *remote* repository in contrast to other back ends like svn.
199 It is necessary to do additionally
203 to sync the change on the remote server.