If you don't already have one, you can make one here. If not create a sample folder named ‘MuskCult’ and place some sample code files in it. I’m assuming you already have a file the you want to place under version control. We’re going to do it the right way and the difficult way. Now that we know what Git is and it’s basic terminologies, let’s see how we can place a file under git. It is equivalent to a git fetch and a git merge. git pull is command used to get files from the remote repository directly into the working directory.git merge is a command used to get the files from the local repository into the working directory.git fetch is a command used to get files from the remote repository to the local repository but not into the working directory.So in the remote repository, all files and changes will be visible to anyone with access to the remote repository. git push is a command used to add all committed files in the local repository to the remote repository.git commit is a command used to add all files that are staged to the local repository.git add is a command used to add a file that is in the working directory to the staging area.Which means that the changes you made to your file are safely stored in the local repository. Which means the files with the updated changes are not yet stored in the local repository. ![]() Which means the files with the updated changes are marked to be committed to the local repository but not yet committed. If you consider a file in your Working Directory, it can be in three possible states. Working Directory, Staging Area, Local Repository and Remote Repository. There are four fundamental elements in the Git Workflow. ![]() repo is nothing but a collection of source code. Git Workflow:īefore we start working with Git commands, it is necessary that you understand what it represents.Ī repository a.k.a. And collaborating long distance becomes as easy as HTML ?. So you don’t have to worry about mailing your files to each other and working with a ridiculous number of copies of the original file. So by using Git you can ensure you both are working on the most recent version of the repository. Now Git takes those changes you and your friend made independently and merges them to a single “ Master” repository. You both are working on the same project files. So imagine you and your friend are collaborating on a project. Git also helps you synchronise code between multiple people. ![]() So I can jump to and fro to any version of the file in the git time continuum. We can select which version of the file we want to use at any point of time. ![]() In the example above, all three cards represent different versions of the same file. A simple example of version history of a file. Or you can simply see what changes you made to your code over time. If at any point while coding you hit a fatal error and don’t know what’s causing it you can always revert back to the stable state. It is basically the history tab for your code editor(With no incognito mode ?). Git helps you keep track of the changes you make to your code. This clone has all of the metadata of the original while the original itself is stored on a self-hosted server or a third party hosting service like GitHub. Instead, every user “clones” a copy of a repository (a collection of files) and has the full history of the project on their own hard drive. So Git does not necessarily rely on a central server to store all the versions of a project’s files. Git is a Distributed Version Control System. Git is a version-control system for tracking changes in computer files and coordinating work on those files among multiple people. And sometimes you just want to know “who wrote this crap”, and having access to that information is worthwhile ?. Using a VCS also means that if you screw things up or lose files, you can generally recover easily. Umm… Okay… But Why Tho? Here’s Why:Ī Version Control System (VCS) allows you to revert files back to a previous state, revert the entire project back to a previous state, review changes made over time, see who last modified something that might be causing a problem, who introduced an issue and when, and more. So ideally, we can place any file in the computer on version control. ADVERTISEMENT Let’s get started! What is Version Control? Version control is a system that records changes to a file or set of files over time so that you can recall specific versions later.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |