I'm building my own rpm's. Usually I use git archive to get a tarball from the commit or tag I'm interested in (suppose I have put a tag 1.0):
git archive --format=tgz --prefix=product-1.0 1.0 > product-1.0.tgz
suppose now I am doing some local developments that I haven't committed yet and I want to get an archive; is there any way to obtain this without having to commit?
edit I could just use something like this:
tar cf product-1.0.tgz --exclude=.git
but that will include all binaries and other untracked files which I prefer not...
Use Git Archive for Files The available list of formats can be retrieved with the git archive --list command. But the Git archive command includes only the files, not the history of those files. You can also use git archive branch to see the history of your branch/tree.
Unstaged vs Staged changesUnstaged changes are changes that are not tracked by the Git. For example, if you copy a file or modify the file. Git maintains a staging area(also known as index) to track changes that go in your next commit.
To archive a repository, go to your Repository Settings Page and click Archive this repository. Before archiving your repository, make sure you've changed its settings and consider closing all open issues and pull requests.
Step 1: Go to your git bash. and then to the repo you want to extract or export. Here, we are going to export this repo named 'Ada August-a Challenge' and it's main branch. Step 2: Now export it to your preferred format and location, here we will export it to the same location in .
I'm not 100% sure this is exactly what you want, but you can stash the changes you've made with git stash create
, which will give you a hash for the current state of the repo - and then create an archive for it with git archive <options> $HASH
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With