If there a way to deploy with git without copying the whole meta data (history of changed)?

StackOverflow https://stackoverflow.com/questions/23547354

  •  18-07-2023
  •  | 
  •  

Question

Dev environment: Linux

If there a way to deploy with git without copying the whole meta data (history of changed)?

I want to be able to push a certain branch, but I don't care much about pushing the history of changes ... if that possible with GIT?

Was it helpful?

Solution

You can checkout a new branch and make a new commit with the current state:

git checkout -b temp
git update-ref -d refs/heads/temp
git commit -m "Fresh commit"

Push the temp branch now!

Or try git checkout --orphan temp to create an orphan branch that behaves the same.

Rebase using git rebase --root -i, but that will be a tedious process.

OTHER TIPS

The entire git history is stored within the .git directory off the root of your project. If you remove that directory on the deployment server, what's left is just the current code. It's not even technically a git project at that point.

Details here: http://gitready.com/advanced/2009/03/23/whats-inside-your-git-directory.html

You're not technically "deploying" just the current code, but the end result is the same.

Hope that's useful.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top