Skip to content

Commit d1fb00d

Browse files
committed
rewritten Bazaar repository importation
1 parent d7216d3 commit d1fb00d

File tree

1 file changed

+29
-43
lines changed

1 file changed

+29
-43
lines changed

book/09-git-and-other-scms/sections/import-bzr.asc

Lines changed: 29 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ So in this case you have nothing to do.
5555

5656
At this point, the way to import a Bazaar repository differs according to that you have a single branch or you are working with a repository that has several branches.
5757

58+
5859
===== Project with a single branch
5960

6061
Now `cd` in the directory that contains your Bazaar repository and initialize the Git repository:
@@ -72,48 +73,6 @@ $ bzr fast-export --plain . | git fast-import
7273

7374
Depending on the size of the project, your Git repository is built in a lapse from a few seconds to a few minutes.
7475

75-
At this point, the `.git` directory and your working tree are all set up, but the working tree and the index are not synchronized with HEAD:
76-
77-
[source,console]
78-
----
79-
$ git status
80-
On master branch
81-
Changes that will be validated:
82-
(use "git reset HEAD <fichier>..." to unstage)
83-
84-
removed : .bzrignore
85-
removed : file.txt
86-
87-
----
88-
89-
This is fixed by typing:
90-
91-
[source,console]
92-
----
93-
$ git reset --hard HEAD
94-
----
95-
96-
Now let us have a look at the files to ignore.
97-
As `.bzrignore`'s format is completely compatible with `.gitignore`'s format, the simplest is to rename your `.bzrignore` file:
98-
[source,console]
99-
----
100-
$ git mv .bzrignore .gitignore
101-
----
102-
103-
Then you have to create a commit that contains this change for the migration:
104-
[source,console]
105-
----
106-
$ git commit -am 'Migration from Bazaar to Git'
107-
----
108-
109-
That's all!
110-
Now you can push the repository onto its new home server:
111-
[source,console]
112-
----
113-
$ git remote add origin git@my-git-server:mygitrepository.git
114-
$ git push origin --all
115-
$ git push origin --tags
116-
----
11776

11877
===== Case of a project with a main branch and a working branch
11978

@@ -149,11 +108,38 @@ git fast-import --import-marks=../marks.git --export-marks=../marks.git
149108
Now `git branch` shows you the `master` branch as well as the `work` branch.
150109
Check the logs to make sure they’re complete and get rid of the `marks.bzr` and `marks.git` files.
151110

152-
Your working copy is still unsynchronized, so let's reset it:
153111

112+
===== Synchronize the staging area
113+
114+
Whatever the number of branches you had and the import method you used, your staging area is not synchronized with HEAD, and with the import of several branches, your working directory is not synchronized neither.
115+
This situation is easily solved by the following command:
154116
[source,console]
155117
----
156118
$ git reset --hard HEAD
157119
----
158120

121+
122+
===== Ignore the files that were ignored with .bzrignore
123+
124+
Now let us have a look at the files to ignore.
125+
As `.bzrignore`'s format is completely compatible with `.gitignore`'s format, the simplest is to rename your `.bzrignore` file.
126+
You will also have to create a commit that contains this change for the migration:
127+
[source,console]
128+
----
129+
$ git mv .bzrignore .gitignore
130+
$ git commit -am 'Migration from Bazaar to Git'
131+
----
132+
133+
134+
===== Send your repository to the server
135+
136+
Here we are!
137+
Now you can push the repository onto its new home server:
138+
[source,console]
139+
----
140+
$ git remote add origin git@my-git-server:mygitrepository.git
141+
$ git push origin --all
142+
$ git push origin --tags
143+
----
144+
159145
Your Git repository is ready to use.

0 commit comments

Comments
 (0)