Sign in Join
Wiki copytemporary

SVN to GIT Cheatsheet: what changed

Revision 0 to 1. Removed lines have a minus sign; added lines have a plus sign.

Title: SVN to GIT Cheatsheet

OldNewLine
1+![Light bulb](https://upload.wikimedia.org/wikipedia/commons/d/d8/Nuvola_apps_ktip.png) **Note:** This page is **not an extension** of [[FPC git]]
2+This is an **alternative** to it.
3+
4+# ABOUT
5+
6+This page contains an introduction to GIT, for users with prior SVN experience.
7+
8+The long version: <https://git-scm.com/book/en/v2>
9+
10+## Alternative to this Page
11+
12+There is a prior page with similar intent: [[FPC git]]
13+
14+This alternative page differs in some main points:
15+
16+ * The alternative is based on the older/established git commands "checkout" and "reset". This page uses "switch" and "restore"
17+
18+Those older commands are harder to learn/understand. They do not have clean distinction between different tasks.
19+
20+The makers of GIT introduced the new commands as a replacement. But the new commands are still marked as "experimental". They are stable and safe to use. But they may still have changes in future git versions.
21+
22+In my opinion the fact that they are easier to learn, compensates well for the off chance that one may later have to learn about potential changes to them.
23+
24+(Also, even old/established commands can get changed. But less likely)
25+
26+ * The alternative page teaches "using the index" as the way to go.
27+
28+This is only one option to use git. As it requires additional steps in several commands, it is less preferable to users coming from svn.
29+
30+The GIT documentation contains all the steps, how to use GIT without "index". So this is as good a way to use git as any other.
31+
32+(One still needs to be aware, in case one accidentally access the index.)
33+
34+## Useful to know background
35+
36+There a few concepts about git, that everyone should at least be aware of.
37+
38+**Please read the page[[FPC git concepts]]**
39+
40+## Outdated info on the Web / ~~git checkout~~
41+
42+![Light bulb](https://upload.wikimedia.org/wikipedia/commons/d/d8/Nuvola_apps_ktip.png) **Note:** Some OS ship older versions of git, that do not yet support this. In this case see [[FPC git]] for how to use "git checkout"
43+
44+A lot of pages on the web, will still give examples for using ~~git checkout~~. **Do not use this.**
45+
46+The new git commands are:
47+
48+**git switch**
49+
50+for changing (and creating) branches.
51+
52+**git restore**
53+
54+for restoring (resetting/reverting) files.
55+
56+# Setup
57+
58+**Clone, to create a repository**
59+
60+If you go to the gitlab home page of the project <https://gitlab.com/freepascal.org/lazarus-ide/lazarus_testconversion> there is a "clone" button, which offers you to put the clone-url into your clipboard.
61+```
62+git clone <https://gitlab.com/freepascal.org/lazarus-ide/lazarus_testconversion.git> ./lazarus_git
63+```
64+
65+ * The folder lazarus_git will be created for you.
66+
67+**Set up your user details**
68+```
69+cd ./lazarus_git
70+ git config user.name martin
71+ git config user.email martin@email-domain.host
72+```
73+
74+ * Those details will appear on every commit you make
75+
76+ * If you clone to an other device, you have to apply the settings again.
77+ * On the same PC, you can make the settings global "git config --global user.email foo@bar.com"
78+
79+ * Those are **not** your login details
80+
81+To view current settings
82+```
83+git config -l
84+```
85+
86+
87+
88+**Adding your credentials (required to push commits)**
89+
90+In order for your credentials to be remembered run (you may check "git config -l" first, to see if already set)
91+
92+ * on Linux / Mac)
93+
94+```
95+git config --global credential.helper store
96+```
97+
98+ * On windows credentials should be stored in the Windows Credential storage.
99+
100+(Unable to test currently / should be either manager-core or wincred)
101+
102+The install may have added this already
103+```
104+git config --global credential.helper wincred
105+```
106+
107+Then run
108+```
109+git push
110+```
111+
112+This will add you for your credentials.
113+
114+ * Enter the username you use to access the gitlab webpage. You can also use the primary email with which you registered.
115+ * Enter your password for the gitlab webpage
116+
117+ * If you do not want to use your main password it is advised to use an "access token" as password (the username remains as is).
118+
119+Log into the gitlab webpage and in your user settings section find the "access token" page. Scope should be read/write repository.
120+
121+## Recommended
122+
123+Some advised defaults.
124+
125+For svn users, it is often desirable to keep the commit history "flat". That means within a single branch, you want to avoid having 2 strains of commits (diverge) and then merge together again.
126+By default git may do exactly that, when you have local commits, and get new commits from the server.
127+
128+To tell git you prefer a single chain of commits (in each branch) run
129+```
130+git config pull.ff only
131+```
132+
133+
134+Depending on preference you can **alternatively** run (see details on fast-forward, rebase, and merge)
135+```
136+git config pull.rebase true
137+```
138+
139+
140+Having added this config allows you to drop the matching argument from "git pull" in the command map below. You can then simply run "git pull" (depending on which config you made, and which option would be advised)
141+
142+**If you do not yet want to read up on the topic, you should go with "pull.ff only"**
143+
144+# Command MAP
145+
146+## svn checkout
147+```
148+git clone <url> <directory>
149+```
150+
151+The amount of history can be limited with (for the master branch, the given branch, all branches)
152+```
153+git clone --depth <number> <url> <directory>
154+ git clone --depth <number> --branch <somebranch> <url> <directory>
155+```
156+
157+## svn update
158+
159+See the notes on fast-forward, rebase and merging. To keep a flat commit line use --ff-only or –rebase. To update the current branch:
160+```
161+git pull --ff-only
162+```
163+
164+If you have unsaved (i.e. uncommitted) changes in files that need to be updated:
165+```
166+git stash save
167+ git pull --ff-only
168+ git stash pop
169+```
170+
171+You can always try to "pull" without "stash". If it is not possible, git will tell you. You can then use the command sequence with "stash" and "pop".
172+
173+"git stash pop" may give a "conflict" error, if the changes can not be merged. You then need to resolve this yourself (same in svn)
174+
175+![Light bulb](https://upload.wikimedia.org/wikipedia/commons/d/d8/Nuvola_apps_ktip.png) **Note:** "svn checkout" into a checkout with local changes will force the checkout, and introduce any conflicts immediately.
176+"git pull --ff-only" will not do that. It will tell you that there would be a conflict. You can then decide to deal with it now or later.
177+
178+You can also use
179+```
180+git pull --rebase
181+```
182+
183+instead of “--ff-only” if you have local commits. This will move your local commits, behind any new commits pulled from the server.
184+
185+
186+To update the all remote branch(es), without touching the local branches.
187+```
188+git fetch --all
189+```
190+
191+After this, you can use "git log origin/branch" to see what changed remotely.
192+
193+ * You may also find examples with: "git remote update"
194+
195+## svn update -r <rev>
196+
197+To go to an earlier revision, in git you create a branch at this earlier commit.
198+```
199+git switch -c <local-branch-name> <commit-hash>
200+```
201+
202+Or to go (let’s say) 3 commits back
203+```
204+git switch -c <local-branch-name> HEAD~3
205+```
206+
207+## svn switch
208+
209+![Light bulb](https://upload.wikimedia.org/wikipedia/commons/d/d8/Nuvola_apps_ktip.png) **Note:** "svn switch" has to retrieve the other branch from the server, and may include an update to its latest version.
210+In GIT all the branches are already downloaded. So switching only needs to update the files in your working directory.
211+If you wish to get the latest version from the server you can run either:
212+
213+ * git fetch --all ## before you switch
214+ * git pull --ff-only ## after the switch
215+
216+```
217+git switch <local-branch-name>
218+```
219+
220+will either:
221+
222+ * switch to an existing local branch
223+ * create a new local branch, from a remote branch of the same name
224+
225+To force create a new local branch (this will give an error, if the local branch already exists):
226+```
227+git switch -c <local-branch-name> <remote-branch-name>
228+```
229+
230+[![Warning-icon.png](/wiki-images/b/b2/Warning-icon.png)](</File:Warning-icon.png>)
231+
232+**Warning:** With -C (uppercase) you can force the creation, abandoning the old local branch. This may loose the data on any commits existing on the old local branch. (This can be used, if the commits in question are hold by yet another local branch)
233+
234+![Light bulb](https://upload.wikimedia.org/wikipedia/commons/d/d8/Nuvola_apps_ktip.png) **Note:** Some pages on the internet will use “git checkout”. Do not use this.
235+
236+## svn commit
237+
238+In git your commit goes to your local branch. To do the full svn commit, you need to commit and push in git.
239+```
240+git commit -m ‘message’ file1 file2 file2 …
241+ git push
242+```
243+
244+You can collect as many commits as you want before you push them.
245+
246+New files need to be “add”ed first.
247+
248+![Light bulb](https://upload.wikimedia.org/wikipedia/commons/d/d8/Nuvola_apps_ktip.png) **Note:** Using git commit, without specifying files will commit the change you “index”ed. Read the section on the index. Indexed files may have different content, than the file on your hard-drive. Using commit with a list of files will always commit the listed files only and with the content you last saved to your hard-drive.
249+
250+To commit all modified files (as on your hard-drive), including any file you deleted (new files still need to be added first):
251+```
252+git commit -m ‘my message’ -a
253+```
254+
255+## svn add
256+```
257+git add -N <file>
258+```
259+
260+![Light bulb](https://upload.wikimedia.org/wikipedia/commons/d/d8/Nuvola_apps_ktip.png) **Note:** If you forget the “-N” the notes on the “index” apply. In that case, if you make further changes to the file, then you must specify the file on the “git commit” command line again.
261+
262+## svn revert
263+```
264+git restore <file>
265+ git restore <folder>
266+ git restore **/<file>
267+```
268+
269+<folder> includes all subfolders. So does folder/* because * matches the names of subfolders.
270+
271+"**" means any path of zero, one or more levels. "anywhere within"
272+
273+Revert to the content of the previous commit:
274+```
275+git restore --source HEAD~1 <file>
276+```
277+
278+![Light bulb](https://upload.wikimedia.org/wikipedia/commons/d/d8/Nuvola_apps_ktip.png) **Note:** Some pages on the internet will use “git checkout”. Do not use this.
279+
280+## svn rename
281+```
282+git mv <source> <dest>
283+```
284+
285+## svn delete
286+```
287+git rm <file>
288+```
289+
290+ * Files that are modified can only be deleted by force -f
291+ * For recursive removal use -r
292+
293+## svn log
294+```
295+git log -n <number_of_entries>
296+ git log --oneline –graph -n <number_of_entries>
297+```
298+
299+Instead of a number of commits, you can give a range of revisions (by hash, branchname, …). This also allows you do get a log of a different branch.
300+```
301+git log HEAD~10..HEAD
302+ git log branch~10..branch
303+```
304+
305+## svn ls
306+
307+for local branches
308+```
309+git branch
310+```
311+
312+to include remote branches
313+```
314+git branch -r
315+```
316+
317+to be verbose
318+```
319+git branch -v
320+```
321+
322+To see tags
323+```
324+git tag
325+```
326+
327+## svn diff
328+
329+![Light bulb](https://upload.wikimedia.org/wikipedia/commons/d/d8/Nuvola_apps_ktip.png) **Note:** the first of the below commands can be affected by the “index”, if you use the index.
330+```
331+git diff
332+ git diff –no-index
333+```
334+
335+To compare with other commits
336+```
337+git diff <hash>
338+ git diff HEAD~10
339+```
340+
341+## svn resolved
342+
343+Conflicted files can be seen using git status.
344+
345+Conflicted lines in the code are marked similar to svn, using <<<, >>>>, ==== sections. You can edit the file, to merge the changes by hand. Or you can use either of the following to only keep your changes, or the changes of the other:
346+```
347+git restore --ours file
348+ git restore --theirs file
349+```
350+
351+You can restore the conflict info in the file with
352+```
353+git restore --merge file
354+```
355+
356+You can switch between the above states as often as you like. But be aware that any changes you edited in the file will be reset with the above restore. Once you have the files in an acceptable state, you can mark them as resolved resolved with either:
357+```
358+git reset file
359+ git add file ## this will use the index
360+```
361+
362+
363+
364+Conflicts during update
365+
366+If the conflict occurred during a “git pull”, then you still have to execute the “git stash pop” (You should have seen a message that it failed) If the conflict occurred after a “git stash pop”, then the stash is also still existent, despite being applied too. To verify view the stash “git stash list”, and to remove the last of the list “git stash drop” (optional specify the hash from the list).
367+
368+## svn shelve
369+
370+To put all your current changes away (the short form only works without arguments / see below)
371+The files in your workdir will be restored to their unmodified state, after the changes were saved.
372+```
373+git stash push
374+ git stash
375+```
376+
377+To retrieve your changes
378+```
379+git stash pop
380+```
381+
382+Changes are stored as patch. So you can apply (pop) them to any commit, not just the one from which you stashed them.
383+
384+To view all stashes
385+```
386+git stash list
387+```
388+
389+More ways to add stashes
390+```
391+git stash push -m 'log message'
392+```
393+
394+And to stash selected files only
395+```
396+git stash push -- file1 file2
397+```
398+
399+## svn export
400+
401+Assuming you current dir is the git repo dir.
402+```
403+git --git-dir=.git --work-tree=/path/to/export/dest restore .
404+```
405+
406+If you only want a specific folder (and its subfolders) to be exported
407+```
408+git --git-dir=.git --work-tree=/path/to/export/dest restore --source=HEAD:folder/in/git .
409+```
410+
411+of course you can also do
412+```
413+git --git-dir=.git --work-tree=/path/to/export/dest restore folder/in/git
414+```
415+
416+but then you get your files in
417+```
418+/path/to/export/dest/folder/in/git/
419+```
420+
421+# Other git commands
422+
423+## git status
424+```
425+git status
426+```
427+
428+Will list files grouped in the following sections. Files can be listed as modified, deleted, new file, renamed.
429+
430+ * Changes to be committed
431+
432+This is the section explained below as “index”. This are files that you specified to git add, git rm, git mv.
433+
434+Note that files can be listed again in other sections. Indicating that they had further changes after they where “added” (or rm/mv).
435+
436+ * Unmerged Path
437+
438+Files that are in conflicted state
439+
440+ * Changes not staged for committed
441+
442+Modified files (before add,rm,mv)
443+
444+ * Untracked files
445+
446+Anything in your working tree that is not known to git (yet)
447+
448+If you have plenty of "untracked files" you can omit them by using
449+```
450+git status -uno
451+```
452+
453+# Fast-Forward, Rebase and Merge
454+
455+**Please read**
456+
457+<https://wiki.lazarus.freepascal.org/FPC_git_concepts#Local_and_Remote_Branches> and tracking section below
458+
459+Unlike svn (where any commit goes straight to the server), in git you make commits locally and send them to the server later.
460+
461+Therefore it can happen, that you added a local commit on the master branch, and some one else has pushed and added his commit to the remote.
462+
463+
464+
465+```
466+A - B - C - D (origin/master as of last pull) - E (master your local commit)
467+ \- E' (commit pushed to the server by someone else => origin/master as it will be after the next pull)
468+```
469+
470+Both "E" commits are based on the same parent "D". The commits no longe form a single flat line.
471+
472+At this point you can't push, as the server would not know how to arrange the two commits. Both commits want to be the head of the same master branch. So you must pull first, and sort this out.
473+
474+![Light bulb](https://upload.wikimedia.org/wikipedia/commons/d/d8/Nuvola_apps_ktip.png) **Note:** In svn the server would rename your commit to F, and put it behind the other E. The svn server does so without knowledge if that result is any good.
475+The svn server will reject your commit, but only if the changes for your E and the remote E conflict. In that case you have to svn update first.
476+In git it is always up to you, to decide if reordering will give a useful result. Hence you always have to pull and sort out the commits.
477+
478+## Fast-Forward
479+
480+This is the most similar to what svn does. This can be done if your local branch is up to date with its remote, and you have no new local commits on top of the remote.
481+```
482+A - B - C - D (master, origin/master)
483+```
484+
485+You pull from the remote, and new commits are loaded from the remote.
486+```
487+git fetch --all
488+ A - B - C - D (master) - E - F (origin/master)
489+```
490+
491+Now you branch is behind, and you want to catch up. You can pull. Even though you already downloaded, and there is nothing new to download, git will perform a fast forward. (Like a life stream, with time shift, when you fell behind)
492+```
493+A - B - C - D (master) - E - F (origin/master)
494+ git pull --ff-only
495+ A - B - C - D - E - F (master, origin/master)
496+```
497+
498+Since you already have the remote changes, and if you do not want to check the server again, you can use (**make sure you specify --ff-only**)
499+For this form of "git merge" with no target the current branch must be tracking a remote branch. It will fast forward to the head of the tracked branch.
500+```
501+A - B - C - D (master) - E - F (origin/master)
502+ git merge --ff-only
503+ A - B - C - D - E - F (master, origin/master)
504+```
505+
506+With git merge you can also decide to forward to one of the commits half way to the remote's origin/master
507+```
508+A - B - C - D (master) - E - F (origin/master)
509+ git merge --ff-only HASH-OF-E
510+ git merge --ff-only origin/master~1 # One before origin/master
511+ A - B - C - D - E (master) - F (origin/master)
512+```
513+
514+
515+A fast forward simply move the pointer of your branch from the commit it is on, to the commit of the tracked remote branch.
516+
517+You can only fast forward to commits, that you can reach by **only** going forward (to commits made on top of the current commit). This ensures that the current commit will remain part of the current branch, and all that is done is that new commits are added to the branch.
518+
519+
520+
521+**What happens to your local modifications?**
522+
523+Lets say you had some modifications to "source.pp".
524+
525+ * If the commits that you forward over, do not change that file, then all is ok. All other files will be updated, and your changes will remain in place.
526+ * If source.pp is changed by any of the commits then fast forward will not work.
527+
528+The same applies, if you have a new local file feature.pp, and one of the commits tries to create this. See the note in #svn_update
529+
530+Use svn stash / svn stash pop
531+
532+## merge (merge within the current branch / merge as pull strategy)
533+
534+[![Warning-icon.png](/wiki-images/b/b2/Warning-icon.png)](</File:Warning-icon.png>)
535+
536+**Warning:** "merge" is the "git way which differs from SVN"
537+The svn-like way is "rebase"
538+
539+Take the initial example.
540+```
541+A - B - C - D (origin/master as of last pull) - E (master your local commit)
542+ \- E' (commit pushed to the server by someone else => origin/master as it will be after the next pull)
543+```
544+
545+If you merge (which is the default in git), then you will keep the E both having the parent D.
546+
547+The branch master will diverge (split into 2 parallel strains) and come together again. On a tracking branch:
548+```
549+git pull --ff-only ## fast forward will not be possible
550+ A - B - C - D - E (master your local commit)
551+ \- E' (origin/master)
552+
553+ git merge
554+
555+ A - B - C - D - E - F (master)
556+ \- E' /
557+ (origin/master)
558+```
559+
560+The merge commit "F" was created. It incorporates the changes from both its parents.
561+```
562+git push
563+ A - B - C - D - E - F (origin/master, master)
564+ \- E' /
565+```
566+
567+The remote server can accept the diversion. Important is that there is only one head commit (to which the branch points). That is now "F".
568+
569+
570+Both E and E' are on the same branch "master". SVN does not know such a layout.
571+
572+**"git rebase" can be used to avoid such "diverging within a branch".**
573+
574+## rebase (merge within the current branch / merge as pull strategy)
575+
576+Take the initial example.
577+```
578+A - B - C - D (origin/master as of last pull) - E (master your local commit)
579+ \- E' (commit pushed to the server by someone else => origin/master as it will be after the next pull)
580+```
581+
582+You want to keep a flat line of commits.
583+
584+The commit E' is already on the server, and there it has the parent D. So that can't be changed any more. E' will remain next after D.
585+
586+This means your commit E must go after E'.
587+You want to get the following commit order
588+```
589+A - B - C - D - E' - E
590+```
591+```
592+git pull --ff-only ## fast forward will not be possible
593+ A - B - C - D - E (master your local commit)
594+ \- E' (origin/master)
595+
596+ git rebase
597+
598+ A - B - C - D - E' (origin/master) - E (master)
599+
600+ git push
601+ A - B - C - D - E' - E (origin/master, master)
602+```
603+
604+# "Tracking Branches" - Connect your local branch and its remote counter-part (aka "Upstream")
605+
606+**A.k.a**
607+
608+Upstream branch
609+
610+**Please read**
611+
612+<https://wiki.lazarus.freepascal.org/FPC_git_concepts#Local_and_Remote_Branches>
613+
614+## What is tracking
615+
616+Say you clone a remote git repository. This repository has the following branches
617+
618+ * master
619+ * fixes-2
620+
621+Those branches are reflected in your local git as ("origin" is the default name for your remote server / this assumes you use this default)
622+
623+ * remote/origin/master
624+ * remote/origin/fixes-2
625+
626+You can checkout to the commits in those branches. But you can not commit to those branches. As they represent the last known state on the server, the only way to update them, is by updating the server. Either you pushing to the server, or you pulling someone else's commits from the server.
627+
628+
629+
630+**Tracking branch**
631+
632+In order to commit, you need (a) local branch(es).
633+```
634+git switch fixes-2
635+```
636+
637+ * If you did not yet have this branch, this will create a local fixes-2 (no prefix) branch for you. If newly created the branch will be at the same commit as origin/fixes-2 (short form).
638+ * If the branch already existed, you may have to fast-forward or rebase it first (see the section on ff/rebase).
639+
640+Because the local name matched the remote name, **and** because you used "git switch", the local branch will have been set to track the remote.
641+
642+
643+Now you have may have commits like this
644+```
645+A => B => C (fixes-2, origin/fixes-2)
646+```
647+
648+Edit a file in the worktree and commit it, you get
649+```
650+A => B => C (origin/fixes-2) => D (fixes-2)
651+```
652+
653+This is described as "Your local branch is one commit ahead".
654+
655+You can now push your local branch to the remote server
656+```
657+git push
658+```
659+
660+This will add your commit "D" to the server, and update the remote branch
661+```
662+A => B => C => D (origin/fixes-2, fixes-2)
663+```
664+
665+
666+
667+**Non tracking branch**
668+
669+You can create a new branch, at the current checked out commit.
670+```
671+git switch -c new-branch-foo
672+ A => B => C => D (origin/fixes-2, fixes-2, new-branch-foo)
673+```
674+
675+This branch does not know about origin/fixes-2. It is not tracking.
676+
677+Now again edit a file and commit. You get
678+```
679+A => B => C => D (origin/fixes-2, fixes-2) => E (new-branch-foo)
680+```
681+
682+If you now try to do
683+```
684+git push
685+```
686+
687+you will get an error. GIT does not know to which branch on the server it should send your commit.
688+
689+For a non tracking branch you need to do:
690+```
691+git push origin fixes-2
692+```
693+
694+If instead of updating the existing remote/fixes-2 branch, you want to create a new branch on the server the you can do:
695+```
696+git push origin new-branch-foo
697+```
698+
699+Here "new-branch-foo" is not the local name, but the name on the server, that will then be reflected an remote/origin/new-branch-foo.
700+
701+So you could also do
702+```
703+git push origin b-foo
704+```
705+
706+And your local branch new-branch-foo would create remote/origin/b-foo
707+
708+## Setting / Un-Setting tracking
709+
710+In the above example the local branch of the same name as the remote was tracking. And ideally that is how you want it to be. But there is no enforcement. While "git switch" may do this for you when creating a new branch, it is possible to have a local "foo" branch that does not track "origin/foo"
711+
712+In order to make a local branch tracking you can give an argument to push.
713+```
714+git push --set-upstream origin remote-branch
715+ git push -u origin remote-branch
716+```
717+
718+When you create a new local branch you can do any of those
719+```
720+git switch --no-track -c local-name origin/remote-name
721+ git switch --track -c local-name origin/remote-name
722+ git switch -t -c local-name origin/remote-name
723+```
724+
725+Using "git switch" to set up a new local branch, which has the same name as the base-name of the remote, will add tracking by default
726+```
727+git switch fixes-3 # if local fixes-3 does not yet exist, and origin/fixes-3 does exist, then the new fixes-3 will be tracking
728+ git switch -c fixes-4 origin/fixes-4 # same base-name, tracking will be enabled
729+```
730+
731+To view the tracking info for your branches
732+```
733+git branch -vv
734+```
735+
736+# Nice to know / for later
737+
738+## git worktree / having more than one checkout
739+
740+Just to mention here, if you want different branches/commits checked out in different directory, you do not need a 2nd clone. You can have several working dirs from one clone. See <https://git-scm.com/docs/git-worktree>
741+
742+## Improving git diff for pascal
743+
744+Git can add context (function name, etc) to the section headers of a diff. For better results with pascal.
745+
746+\- Edit .git/info/attributes
747+```
748+*.pas diff=fpc
749+ *.pp diff=fpc
750+ *.lpr diff=fpc
751+ *.inc diff=fpc
752+```
753+
754+Add to your congif (edit the file)
755+```
756+[diff "fpc"]
757+ wordRegex = "[a-zA-Z_][a-zA-Z0-9_]*|[0-9.e]+|[%&][0-9]+|(\\$|0[xX])[0-9a-fA-F]+|<>|<=|>=|:=|>>|<<|\\.\\.|\\(\\*|\\*\\)"
758+ xfuncname = "^([ \\t]*(class[ \\t]+)?(procedure|function|constructor|destructor|operator)[ \\t]+&?[a-zA-Z_][a-zA-Z0-9_]*\\.&?[a-zA-Z_][a-zA-Z0-9_]*.*)$\n^((class[ \\t]+)?procedure|function|constructor|destructor|operator)[ \\t]+&?[a-zA-Z_][a-zA-Z0-9_]*.*)$\n^([ \\t]*(implementation|interface|initialization|finalization)[ \\t]*([/][/].*)?)$\n^([ \\t]*&?[a-zA-Z_][a-zA-Z0-9_]*[ \\t]*=[ \\t]*(class|interface|object|record|type[ \\t]helper)([\\( \\t][^;]*)?([/][/].*)?)$"
759+```
760+
761+---
762+*From the Free Pascal wiki, page "SVN to GIT Cheatsheet", as the Internet Archive kept it on 2025-02-19, last changed on 2021-12-10. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).*

Back to history