For example, if I now create a helloworld file and do git add helloworld (which is telling Git to add the file called helloworld to the git object store), I get something like this: $ tree. For every file in your project that you add, Git generates a hash for the file and stores the file under that hash. This is how Git stores everything internally. Git consists of 3 parts: the object store, the index and the working directory. We will go into all the important bits, one by one. This is how Git controls and manages your entire project. In every git repository, you’ll see something like this $ tree. Introducing the magic controlled by a hidden folder. Status: Displays information about current repository status Where to Git? Merge: An action to combine two different versions of code Push: An action to send updated code to the remote Pull: An action to get updated code from the remote Also, ensures you have a backup in case you break your laptop Can be in another folder or in the cloud (for example: Github): helps other people to easily collaborate, as they don’t have to get a copy from your system - they can just get it from the cloud. Head: A “pointer” to the latest code you were working onĪdd: An action to ask Git to track a fileĬommit: An action to save the current state - such that one can revisit this state if needed If not, here’s a basic vocabulary to help you get started. I am assuming you know the basic commands in Git, or have heard about them and used them at least once. That is exactly what versioning is trying to prevent. Once you’re through this, I promise you’ll realise the folly of doing what the XKCD comic above says. Figure out how Git works, and you’ll never again have a problem making things work. The answer to all these problems is versioning! Having versions for everything you’ve coded ensures you know who made the changes, what changes and exactly where, since the beginning of the project!Īnd now, I invite you to stop thinking of (g)it as a blackbox, open it up and find out what treasures await. You don’t remember what changes you made to the existing code base to create this new feature. I’ll take it a step further - say not a project with many contributors, just a small project with you as the creator, maintainer and distributor: You create a new feature for this project, which introduces subtle bugs you find out later. Did someone introduce a change that broke the entire system? How do you figure out what that change was? How do you go back to how things were before? Back to the unbroken wonderland? Here’s the basic idea: As projects get too large, with too many contributors, it gets impossible to track who did what and when. “It’s a version control system.” Why do I need it?Īlright, alright, I’m not being too helpful, yet.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |