# How to translate a directory named "A" with src files in it to a package named "B.jl" using PkgTemplates without loosing the git commit history?

**URL:** https://discourse.julialang.org/t/how-to-translate-a-directory-named-a-with-src-files-in-it-to-a-package-named-b-jl-using-pkgtemplates-without-loosing-the-git-commit-history/97319
**Category:** General Usage
**Tags:** question
**Created:** [April 10, 2023, 7:55pm UTC](https://discourse.julialang.org/t/how-to-translate-a-directory-named-a-with-src-files-in-it-to-a-package-named-b-jl-using-pkgtemplates-without-loosing-the-git-commit-history/97319 "2023-04-10T19:55:02Z")
**Posts on this page:** 16
**Page:** 1

<div class="post-metadata">

### Author: ![martinmestre](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/martinmestre/32/215857_2.png) [@martinmestre](https://discourse.julialang.org/u/martinmestre)
#### Post date: [April 10, 2023, 7:55pm UTC](https://discourse.julialang.org/t/how-to-translate-a-directory-named-a-with-src-files-in-it-to-a-package-named-b-jl-using-pkgtemplates-without-loosing-the-git-commit-history/97319/1 "2023-04-10T19:55:02Z")

</div>

The situation is that I have recently decided to use PkgTemplates and would like to adapt some directories where I have been coding (neither of them is yet a package but they will be).  
Maybe this is a basic git question without relation to Julia?  
Thanks!

---

<div class="post-metadata">

### Author: ![PetrKryslUCSD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petrkryslucsd/32/215825_2.png) [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)
#### Post date: [April 10, 2023, 7:56pm UTC](https://discourse.julialang.org/t/how-to-translate-a-directory-named-a-with-src-files-in-it-to-a-package-named-b-jl-using-pkgtemplates-without-loosing-the-git-commit-history/97319/2 "2023-04-10T19:56:59Z")

</div>

Set up B.jl as a package, and then copy the source files over from A. That’s it.

---

<div class="post-metadata">

### Author: ![martinmestre](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/martinmestre/32/215857_2.png) [@martinmestre](https://discourse.julialang.org/u/martinmestre)
#### Post date: [April 10, 2023, 7:57pm UTC](https://discourse.julialang.org/t/how-to-translate-a-directory-named-a-with-src-files-in-it-to-a-package-named-b-jl-using-pkgtemplates-without-loosing-the-git-commit-history/97319/3 "2023-04-10T19:57:42Z")

</div>

Thanks. Do you consider the local .git/ directory as source files? I thought that within the .git/ directory there was the information about the old directory “A”, for example the github url of directory A.

---

<div class="post-metadata">

### Author: ![GunnarFarneback](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gunnarfarneback/32/1827_2.png) [@GunnarFarneback](https://discourse.julialang.org/u/GunnarFarneback)
#### Post date: [April 10, 2023, 8:13pm UTC](https://discourse.julialang.org/t/how-to-translate-a-directory-named-a-with-src-files-in-it-to-a-package-named-b-jl-using-pkgtemplates-without-loosing-the-git-commit-history/97319/4 "2023-04-10T20:13:06Z")

</div>

If you want to retain git history it seems more natural to copy in the opposite direction.

---

<div class="post-metadata">

### Author: ![martinmestre](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/martinmestre/32/215857_2.png) [@martinmestre](https://discourse.julialang.org/u/martinmestre)
#### Post date: [April 10, 2023, 8:19pm UTC](https://discourse.julialang.org/t/how-to-translate-a-directory-named-a-with-src-files-in-it-to-a-package-named-b-jl-using-pkgtemplates-without-loosing-the-git-commit-history/97319/5 "2023-04-10T20:19:38Z")

</div>

Thanks. Could you give an example so I understand what you refer to?

---

<div class="post-metadata">

### Author: ![GunnarFarneback](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gunnarfarneback/32/1827_2.png) [@GunnarFarneback](https://discourse.julialang.org/u/GunnarFarneback)
#### Post date: [April 10, 2023, 8:29pm UTC](https://discourse.julialang.org/t/how-to-translate-a-directory-named-a-with-src-files-in-it-to-a-package-named-b-jl-using-pkgtemplates-without-loosing-the-git-commit-history/97319/6 "2023-04-10T20:29:28Z")

</div>

Run PkgTemplates in some empty directory, then copy the generated files over to your code directory. Possibly you want to configure PkgTemplates not to push things to github but handle that yourself. Whatever git history PkgTemplates creates is in any case of no particular interest compared to the git history of your code.

---

<div class="post-metadata">

### Author: ![martinmestre](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/martinmestre/32/215857_2.png) [@martinmestre](https://discourse.julialang.org/u/martinmestre)
#### Post date: [April 10, 2023, 8:35pm UTC](https://discourse.julialang.org/t/how-to-translate-a-directory-named-a-with-src-files-in-it-to-a-package-named-b-jl-using-pkgtemplates-without-loosing-the-git-commit-history/97319/7 "2023-04-10T20:35:18Z")

</div>

Thanks! You mean I copy everything generated by PkgTemplates but not the .git/ directory? In that case I would have to go on with a directory named “A” right?

---

<div class="post-metadata">

### Author: ![GunnarFarneback](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gunnarfarneback/32/1827_2.png) [@GunnarFarneback](https://discourse.julialang.org/u/GunnarFarneback)
#### Post date: [April 10, 2023, 8:49pm UTC](https://discourse.julialang.org/t/how-to-translate-a-directory-named-a-with-src-files-in-it-to-a-package-named-b-jl-using-pkgtemplates-without-loosing-the-git-commit-history/97319/8 "2023-04-10T20:49:37Z")

</div>

You can rename files and directories as you want. The only requirement from the package manager is that the name in `Project.toml` has a corresponding file `src/$(name).jl` and that file creates a module of the same name.

And yes, skip the `.git` directory generated by PkgTemplates.

---

<div class="post-metadata">

### Author: ![PetrKryslUCSD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petrkryslucsd/32/215825_2.png) [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)
#### Post date: [April 10, 2023, 9:03pm UTC](https://discourse.julialang.org/t/how-to-translate-a-directory-named-a-with-src-files-in-it-to-a-package-named-b-jl-using-pkgtemplates-without-loosing-the-git-commit-history/97319/9 "2023-04-10T21:03:28Z")

</div>

Yes, I would copy that as well. Overwriting the .git in B.jl.

---

<div class="post-metadata">

### Author: ![martinmestre](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/martinmestre/32/215857_2.png) [@martinmestre](https://discourse.julialang.org/u/martinmestre)
#### Post date: [April 11, 2023, 4:02pm UTC](https://discourse.julialang.org/t/how-to-translate-a-directory-named-a-with-src-files-in-it-to-a-package-named-b-jl-using-pkgtemplates-without-loosing-the-git-commit-history/97319/10 "2023-04-11T16:02:38Z")

</div>

Thanks for you answer. Is it possible that I should manually edit the url line inside the file `.git/config` in order to update the github repository?

---

<div class="post-metadata">

### Author: ![martinmestre](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/martinmestre/32/215857_2.png) [@martinmestre](https://discourse.julialang.org/u/martinmestre)
#### Post date: [April 11, 2023, 4:04pm UTC](https://discourse.julialang.org/t/how-to-translate-a-directory-named-a-with-src-files-in-it-to-a-package-named-b-jl-using-pkgtemplates-without-loosing-the-git-commit-history/97319/11 "2023-04-11T16:04:26Z")

</div>

Thanks @GunnarFarneback ! I will try in both ways. The problem I see is that I want my PkgB to be in `.julia/dev/` but not located in the directory A.

---

<div class="post-metadata">

### Author: ![GunnarFarneback](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gunnarfarneback/32/1827_2.png) [@GunnarFarneback](https://discourse.julialang.org/u/GunnarFarneback)
#### Post date: [April 11, 2023, 6:40pm UTC](https://discourse.julialang.org/t/how-to-translate-a-directory-named-a-with-src-files-in-it-to-a-package-named-b-jl-using-pkgtemplates-without-loosing-the-git-commit-history/97319/12 "2023-04-11T18:40:14Z")

</div>

> [@martinmestre](#):
>
> Is it possible that I should manually edit the url line inside the file `.git/config` in order to update the github repository?

You can but the usual way to manipulate that is with `git remote set-url`.

> [@martinmestre](#):
>
> The problem I see is that I want my PkgB to be in `.julia/dev/` but not located in the directory A.

Move the package directory or make a new clone in `.julia/dev`. Not that there is any particular advantage having your package in `.julia/dev`.

---

<div class="post-metadata">

### Author: ![martinmestre](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/martinmestre/32/215857_2.png) [@martinmestre](https://discourse.julialang.org/u/martinmestre)
#### Post date: [April 11, 2023, 6:41pm UTC](https://discourse.julialang.org/t/how-to-translate-a-directory-named-a-with-src-files-in-it-to-a-package-named-b-jl-using-pkgtemplates-without-loosing-the-git-commit-history/97319/13 "2023-04-11T18:41:54Z")

</div>

Thanks a lot.

---

<div class="post-metadata">

### Author: ![martinmestre](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/martinmestre/32/215857_2.png) [@martinmestre](https://discourse.julialang.org/u/martinmestre)
#### Post date: [April 11, 2023, 8:22pm UTC](https://discourse.julialang.org/t/how-to-translate-a-directory-named-a-with-src-files-in-it-to-a-package-named-b-jl-using-pkgtemplates-without-loosing-the-git-commit-history/97319/14 "2023-04-11T20:22:52Z")

</div>

For the moment I will start by locating the development packages in `.julia/dev/` but I would like to know for the future, how do you do otherwise. How does Julia know where is the package when doing `] dev MyPkg` ?

---

<div class="post-metadata">

### Author: ![GunnarFarneback](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gunnarfarneback/32/1827_2.png) [@GunnarFarneback](https://discourse.julialang.org/u/GunnarFarneback)
#### Post date: [April 11, 2023, 8:29pm UTC](https://discourse.julialang.org/t/how-to-translate-a-directory-named-a-with-src-files-in-it-to-a-package-named-b-jl-using-pkgtemplates-without-loosing-the-git-commit-history/97319/15 "2023-04-11T20:29:02Z")

</div>

Use the local path with `] dev`. Most of the time when I develop packages I just activate them (usually with `julia --project`) though.

---

<div class="post-metadata">

### Author: ![martinmestre](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/martinmestre/32/215857_2.png) [@martinmestre](https://discourse.julialang.org/u/martinmestre)
#### Post date: [April 11, 2023, 8:38pm UTC](https://discourse.julialang.org/t/how-to-translate-a-directory-named-a-with-src-files-in-it-to-a-package-named-b-jl-using-pkgtemplates-without-loosing-the-git-commit-history/97319/16 "2023-04-11T20:38:22Z")

</div>

Thanks!
