You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: book/09-git-and-other-scms/sections/client-bzr.asc
+20-5Lines changed: 20 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -74,11 +74,26 @@ $ git fetch
74
74
75
75
===== Ignore what is ignored with .bzrignore
76
76
77
-
As the format of the `.bzrignore` file is completely compatible with `.gitignore`'s one, and as you shouldn't make a `.gitignore` file in your repository, it is enough to make a symbolic link to `.bzrignore` so that the potential changes of `.bzrignore` are taken into account:
78
-
[source,console]
79
-
----
80
-
$ ln -s .bzrignore .git/info/exclude
81
-
----
77
+
Since you are working on a project managed with Bazaar, you shouldn't create a `.gitignore` file because you _may_ accidentally set it under version control and the other people working with Bazaar would be disturbed.
78
+
The solution is to create the `.git/info/exclude` file either as a symbolic link or as a regular file.
79
+
We'll see later on how to solve this question.
80
+
81
+
Bazaar uses the same model as Git to ignore files, but also has two features which don't have an equivalent into Git.
82
+
The complete description may be found in http://doc.bazaar.canonical.com/bzr.2.7/en/user-reference/ignore-help.html[the documentation].
83
+
The two features are:
84
+
85
+
1. "!!" allows you to ignore certain file patterns even if they're specified using a "!" rule.
86
+
2. "RE:" at the beginning of a line allows you to specify a https://docs.python.org/3/library/re.html[Python regular expression] (Git only allows shell globs).
87
+
88
+
As a consequence, there are two different situations to consider:
89
+
90
+
1. If the `.bzrignore` file does not contain any of these two specific prefixes, then you can simply make a symbolic link to it in the repository: `ln -s .bzrignore .git/info/exclude`
91
+
2. Otherwise, you must create the `.git/info/exclude` file and adapt it to ignore exactly the same files in `.bzrignore`.
92
+
93
+
Whatever the case is, you will have to remain vigilant against any change of `.bzrignore` to make sure that the `.git/info/exclude` file always reflects `.bzrignore`.
94
+
Indeed, if the `.bzrignore` file were to change and contained one or more lines starting with "!!" or "RE:", Git not being able to interpret these lines, you'll have to adapt your `.git/info/exclude` file to ignore the same files as the ones ignored with `.bzrignore`.
95
+
Moreover, if the `.git/info/exclude` file was a symbolic link, you'll have to first delete the symbolic link, copy `.bzrignore` to `.git/info/exclude` and then adapt the latter.
96
+
However, be careful with its creation because with Git it is impossible to re-include a file if a parent directory of that file is excluded.
Copy file name to clipboardExpand all lines: book/09-git-and-other-scms/sections/import-bzr.asc
+5-2Lines changed: 5 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -129,12 +129,15 @@ $ git reset --hard HEAD
129
129
===== Ignoring the files that were ignored with .bzrignore
130
130
131
131
Now let's have a look at the files to ignore.
132
-
As `.bzrignore`'s format is completely compatible with `.gitignore`'s format, the simplest is to rename your `.bzrignore` file.
133
-
You will also have to create a commit that contains this change for the migration:
132
+
The first thing to do is to rename `.bzrignore` into `.gitignore`.
133
+
If the `.bzrignore` file contains one or several lines starting with "!!" or "RE:", you'll have to modify it and perhaps create several `.gitignore` files in order to ignore exactly the same files that Bazaar was ignoring.
134
+
135
+
Finally, you will have to create a commit that contains this modification for the migration:
0 commit comments