Reputation: 596
I'm new to Git, so I don't know if this question makes sense or not but I am trying to save storage, so I want the local files to be deleted after I push to Github. I was wondering if this happens automatically or not. Are the local files only the latest versions, or all versions?
Upvotes: 2
Views: 1532
Reputation: 21938
Two things I think are worth making clear about your question :
pushing does not delete anything local. You could use hooks or other scripts to automate such a process, but it's clearly not a built-in or standard process.
"saving storage by keeping only the most recent versions" is not really relevant to git, when you know what it stores and how. Basically, commits are snapshots of your entire repo. However, this does not mean that you're duplicating your whole repo each time you move a coma in your code and commit that (thanks God, Linus and their peers). In fact, if a file doesn't change between two commits, the same blob of its contents is referenced again and so most commits don't cause remarkable increases in the repo size, unless they modify many big files of course.
Upvotes: 2
Reputation: 14723
I want the local files to be deleted after I push to Github. I was wondering if this happens automatically or not.
Short answer: no.
To be more precise, Git is a distributed version control system, meaning that each repository (local or remotely on GitHub) contains the whole history of the repository.
I am trying to save storage
FYI Git provides some features aiming at reducing storage cost, for example:
git gc − Cleanup unnecessary files and optimize the local repository
but in practice it is not really necessary to run this command on a regular basis; notably as Git repositories are more size-efficient than other version control systems (e.g., creating a local branch with the centralized VCS Subversion could lead to doubling the size of the overall repository folder, while in Git the cost of one such branch operation is negligible: it only adds a "pointer" to the relevant commit).
Upvotes: 1