Lastly, you need to install Git on your computer. The terminal is a basic tool that all developers should understand. For the purpose of this article, we'll use the terminal (also called the command line) to run Git commands. The terminal will be your paper on which you'll write Git commands. But you can also run terminal commands for Git. You can use programs with graphical user interfaces for Git. But we also need to mention two methods to run Git commands. Why GitHub is a great communication tool for web developers.īy now it should be clear what Git is and what repositories are. A remote repository also serves as a central hub to which members of a web development team can connect to access project code. If your code disappears from your local repository, you can restore absolutely the same code from a remote repository. Remote storehouses (repositories like GitHub or BitBucket) store exactly the same code that you have in your local repository (on your home computer). With GitHub or BitBucket, however, it's a different story. And you'll still lose some valuables (the original things). If your things disappear from home (God forbid!), you'll be able to recover copies or clones (at best) from a storehouse. In the real world, you can't have exactly the same stuff at home and in a storehouse. Why do we use local and remote repositories? Let's explain a little bit. Thanks to Git, you can copy your entire project to a remote repository while keeping it in a local repository as well. You may have heard about remote repositories such as GitHub, BitBucket, and GitLab. A remote repository is like a public storehouse located in a different building. So a repository on your own computer will be called local. If you store your stuff (code) at home (on a computer with a Git directory), you store your stuff locally. What's a local repository? Let's use our imagination to understand repositories. But you can still see a repository in your code editor or IDE: (Throughout the entire article we'll use the term directory, not folder.) You can't see repositories in your filesystem as they're hidden. GitĪ repository is just a directory (a folder) in your project's root directory. You may be thinking, "Not again! We're talking about a repository now?" I know who did what, when, and why. Afterwards, Git can track project files and directories and add them to the repository. In all its complexity, Git works quite simply: you first need to create a local repository in your project's root directory (folder). These capabilities listed above don't tell how Git actually works, however. Merge code from different computers and different team members.Thanks to Git, you'll be able to do the following: A version control system is simply software that lets you effectively manage application versions. "Distributed" means that all developers within a team have a complete version of the project. Git is a distributed version control system (DVCS). To do so, we should also start using basic Git commands. But to make Git our best friend, we should understand how Git works. Git easily solves both problems we've described: managing project versions and sharing code among developers. But again, how can you know for sure which version of code is the latest? And if your friend wants to merge your code with his version in the same file, would you like to go line by line to see whose code will be merged into which part of a file? We bet you wouldn't. How can you share your code with the entire development team? I can use Dropbox, Google Drive, OneDrive, a flash drive… any other drive to store my code and share it with everyone! Here's another problem of development without Git: several developers will work on the same project, and they'll also need access to previous app versions. How can you know which exact app version is the one you need? Git, on the other hand, can tell you what project version you're restoring. Restoring a project from several places, however, isn't a viable option. Without Git, you'd have to save each version of the project to a different place. When you remove or rework code, you can't restore its previous state (read: version). Therefore, you create a third version of your app. Still later, you decide to rework the first feature. But the next day you develop the first feature, and thus you create a second version of the app. These basic files constitute the first version of your application. When you start a new project, you create several basic files. The #1 problem of life without Git is that you can't adequately manage project versions. Sadly, your life as a web developer will also be complicated without Git, and here's why. Git is very complicated, as you can't learn all its concepts by just using it. Having a Git cheat sheet taped to our table doesn't help. Most of us dislike Git on the first try even after running the most basic Git commands.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |