I can access my company Stash project repositories. I cloned the project into my local Git repository through Eclipse IDE. For that, I installed required Git plugins into Eclipse.
My questions are:
The git commit and git stash commands are similar in that both take a snapshot of modified files in the git working tree and store that snapshot for future reference. The key differences between the two are as follows: A commit is part of the public git history; a stash is stored locally.
All are stored in . git/refs/stash . git stash saves stashes indefinitely, and all of them are listed by git stash list . Please note that dropping or clearing the stash will remove it from the stash list, but you might still have unpruned nodes with the right data lying around.
Use git stash when you want to record the current state of the working directory and the index, but want to go back to a clean working directory. The command saves your local modifications away and reverts the working directory to match the HEAD commit.
The stash command cleans up the working repository, reverting it to the last commit. Stashing changes allows users to run other Git commands, such as checkout or pull , or to switch to a different branch without causing a mess on the main branch due to unsaved changes.
Some brief information about Stash and Git.
Git is a distributed version control system.
Stash is a repository management system of Atlassian. It can be used to manage Git repositories, also it can be used to manage repositories of other version control system like mercurial.
A good overview for each product can be found in their official sites;
Git official site, about page
There are many repository management system you can use with Git. One of the most popular is Stash in Enterprise world. But when you look to open source world, GitHub is the most popular one as far as I know.
You can create repository, push, or pull your code into Git repositories whether they are in your local computer or they are in remote corporate servers. Using a repository management system ( like Stash) for this kind of task is not necessary, but It is sometimes preferred, especially by the companies which has huge It departments.
So, Git, and Stash are not alternative but complementary to each other. You can think Git as a kernel and stash as the shell surrounding the kernel.
But, why we need repository management systems;
Now, Lets try to answer your questions;
I can access my company Stash project repositories. I cloned the project into my local Git repository
Whether Code repository is on remote server behind stash or it is in local computer. It is a Git repository.
Git is just a facilitator to communicate with Stash?
No, Vice versa is more correct. Git is the core of VCS, you use stash to make it more manageable, secure, and easy to use in your corporate.
Can't we use Git as distributed repository instead of Stash?
First you can not use Git instead of Stash, because they are not alternative to each other. But they are complement to each other.
If you mean using Git as remote repository, sure you can use it.
For clarification, Git is distributed not because you can have remote repositories. Whether centralized or distributed, you can have remote repository on all VCS. Distributed means, when you clone a repository, you also clone all history etc. In this structure, you can have a central repository but it is not required. If centrol repository get corrupted, it is not a big deal, any node can become new central repository. Even though in corporate world having a central repository is best practice, some open source projects ( for instance Linux kernel) don't have a central repository.
What is the relationship between those two tools?
I think it is already explained above. They are complementary to each other. Git is the VCS, and stash is repository management tool. It makes Git more secure and manageable for corporate IT departments.
Without Git, can the code be cloned, committed to Stash? Or, without Git, can Stash exist?
It is already explained as well. You can use Stash with other VCS. Git is not necessary. But you need at least one VCS.
You can not commit/clone code to/from stash. You can commit/clone code to/from VCS via stash.
VCS: Version Control System
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