Aniket Yadav
Aniket Yadav

Reputation: 139

How to Create a Git metadata(.git folder)?

How to Create a Git metadata(.git folder) in the tarball so that I can look at my commit logs and understand how the solution evolved.

Upvotes: 0

Views: 587

Answers (2)

Parth Shah
Parth Shah

Reputation: 1475

You can also recursively zip the contents of your source code folder. The .git folder will be added.

$ ls
SourceCode    Documents    ...
$ zip -r SourceCode.zip SourceCode/

You will now have a zip folder called SourceCode.zip. This will contain all the original contents including the git history, compressed. If you get an error that says command not found: zip, you can install zip using the command sudo apt install zip in your shell.

For more info, man zip in your shell to bring up the manual or this link.

Upvotes: 0

Łukasz Ślusarczyk
Łukasz Ślusarczyk

Reputation: 1864

Simply compressing upper directory, that is directory containing your .git, will work. Such tgz file should contain all files including hidden ones.

ls -a
. .. some-source-file.cpp .git
cd ..
tar czf project.tgz project

Unpacking by

tar xzf project.tgz

Will provide the other team with both source code and .git folder.

Upvotes: 1

Related Questions