index.md - sites - public wiki contents of suckless.org | |
git clone git://git.suckless.org/sites | |
Log | |
Files | |
Refs | |
--- | |
index.md (3139B) | |
--- | |
1 How to maintain dwm configuration and customization in git | |
2 ========================================================== | |
3 Customizations can be managed directly in git. | |
4 | |
5 The concept | |
6 ----------- | |
7 By recording changes and applied patches as commits in a special branch … | |
8 can be rebased on top of the master branch when required. | |
9 | |
10 Cloning the repository | |
11 ---------------------- | |
12 You need to have the [Git VCS](http://git-scm.com/) installed first. The… | |
13 the upstream repository locally | |
14 | |
15 git clone git://git.suckless.org/dwm | |
16 | |
17 Recording customizations | |
18 ------------------------ | |
19 Create a special branch where all the customizations will be kept. It do… | |
20 matter what the name is, it just needs to be something different than `m… | |
21 | |
22 git branch my_dwm | |
23 | |
24 Now switch to the new branch. This will do nothing at the moment as the | |
25 branches are the same. | |
26 | |
27 git checkout my_dwm | |
28 | |
29 Now make your changes. If you want to apply one of the [contributed | |
30 patches](//dwm.suckless.org/patches/) you can use the `git apply` command | |
31 | |
32 git apply some_patch.diff | |
33 | |
34 Note that many patches make changes `config.def.h` instead of `config.h`. | |
35 Either move those changes also to `config.h`, or add `rm config.h` to the | |
36 `clean` target in the `Makefile`. | |
37 | |
38 Then record the changes as commits | |
39 | |
40 # tell git to add the changes in the given file(s) to be recorded | |
41 git add some_file.ext | |
42 # git will ask you to provide a message describing your changes, | |
43 # while showing a diff of what's being commited. | |
44 git commit -v | |
45 | |
46 ### Experimenting with different combinations of customizations | |
47 | |
48 If you plan on experimenting with different combinations of customizatio… | |
49 might be easier to record the commits in separate feature branches by fi… | |
50 creating and checking out a branch and then recording the changes as com… | |
51 Having patches in different branches also helps to keep their dependenci… | |
52 transparent by creating branches based on other patch branches. | |
53 | |
54 Then merge the selected combination of changes into your branch | |
55 | |
56 git merge some_feature_branch | |
57 git merge other_feature_branch | |
58 | |
59 If you some conflicts occur, resolve them and then record the changes and | |
60 commit the result. `git mergetool` can help with resolving the conflicts. | |
61 | |
62 Updating customizations after new release | |
63 ----------------------------------------- | |
64 When the time comes to update your customizations after a new release of… | |
65 when the dwm repository contains a commit fixing some bug, you first pul… | |
66 new upstream changes into the master branch | |
67 | |
68 git checkout master | |
69 git pull | |
70 | |
71 Then rebase your customization branch on top of the master branch | |
72 | |
73 git checkout my_dwm | |
74 git rebase --preserve-merges master | |
75 | |
76 The `--preserve-merges` option ensures that you don't have to resolve co… | |
77 which you have already resolved while performing merges again. | |
78 | |
79 In case there are merge conflicts anyway, resolve them (possibly with th… | |
80 of `git mergetool`), then record them as resolved and let the rebase con… | |
81 | |
82 git add resolved_file.ext | |
83 git rebase --continue | |
84 | |
85 If you want to give up, you can always abort the rebase | |
86 | |
87 git rebase --abort | |
88 | |
89 Author | |
90 ------ | |
91 * [Ondřej Grover](mailto:[email protected]) |