Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Best practice for Cloning and Committing the "Wiki" repo for a BitBucket project

In BitBucket, you can create a Wiki for a project. However, the Wiki itself is a repo that is separate from the source repo. When you clone it, it creates a repo with the name "wiki".

Where is the ideal or conventional place to clone this repo? Do you put it inside the source repo? If so, do you .gitignore /wiki when committing from the source repo? Or do you include the wiki repo in the source repo?

When pushing, do you commit twice, once in the source repo and then again in the wiki repo? Or can you modify the source's git to commit both the source and the wiki?

Thank you.

like image 626
Some Noob Student Avatar asked Feb 27 '13 23:02

Some Noob Student


2 Answers

The ideal way is using submodule function of Git:

$ cd project
$ git submodule add https://bitbucket.org/user/project.git/wiki

This creates a folder wiki and .gitmodules file, then:

$ cd wiki
$ nano Home.md

Change something of info in the file, and:

$ git add .
$ git commit -m "Some comment"
$ git push origin master

Returning to project:

$ cd ..
$ git add .
$ git commit -m "Added wiki module"
$ git push [remoteName] [remoteBranch]

With this the project repo will generate a link a specific commit of wiki repo, you can update both o only one of them.

I hope this is helpful.

More info: https://git-scm.com/book/en/v2/Git-Tools-Submodules

like image 74
Deoxyseia Avatar answered Nov 01 '22 04:11

Deoxyseia


I maintain following structure for repositories.

enter image description here

The Idea is to maintain code repo and it's related wiki as siblings. This way there is no need to tell .gitignore to ignore any wiki related files. Also, you only push to the repo where you are making changes. Hope, this is what you were looking for.

like image 27
vaibhav Avatar answered Nov 01 '22 04:11

vaibhav