How To Install And Configure Git on Computer?
Installing Git on Windows
On Windows, we will download the “Git for Windows” package from here:
When running the installer EXE, you ought to choose the default options on each screen. After finishing the installation, you’ll begin working with Git by starting the “Git Bash” application. You‘ll find it within the Windows START menu, inside the “Git” folder: Installing Git on Mac OS On Mac OS X, a one-click installer package is out there which will be downloaded from here: https://sourceforge.net/projects/git-osx-installer/ Once this is often installed, we will jump right into Git by starting the “Terminal. app” on our Mac. We‘ll find this within the “Utilities” subfolder of our “Applications” folder in Finder:
A couple of very basic configurations should be made before we start. We should always set our name and email address also as enable coloring to doll up command outputs:
$ git config –global user.the name “John Doe”
$ git config –global user.email “email@example.com”
$ git config –global color.ui auto
The Basic Workflow of Version Control
Before we stray in Git commands, we ought to understand what a basic workflow with version control seems like. We‘ll rehearse each step intimately later during this book. But first, let‘s get an understanding of what the workflow, generally, is like. the foremost basic building block of version control may be a “repository”.
Getting such a repository on our local machine is often wiped out in two ways: If we have a project locally on our computer that’s not yet under version control, we will initialize a replacement repository for this project. If we‘re aged board a project that‘s already running, the likelihood is that there’s a repository on a foreign server (on the web or on our local network). We‘ll then probably be given a URL to the present repository that we’ll then “clone” (download/copy) to our local computer.
1. As soon as we’ve got an area repository, we’ll start performing on our files: modify, delete, add, copy, rename, or move files in whatever application (our favorite editor, a file browser, …) we favor . during this step, we don‘t have to be careful with love or money. Just make any changes necessary to maneuver our project forward.
2. It‘s only you are feeling you‘ve reached an interesting state that we’ve to think about version control again. Then it‘s time to conclude our changes during a commit.
3. However, before we commit, we‘ll want to urge a summary of what we‘ve changed thus far. In Git, we‘ll use the “status” command to urge an inventory of all the changes we performed since the last commit: which files did we change? Did we create any new ones or delete some old ones?
4. Next, we tell Git which of our local changes we would like to conclude within the next commit. Only because a file was changed doesn‘t mean it’ll be a part of a subsequent commit! Instead, we’ve to explicitly decide which changes we want to incorporate. to try to do this, we add them to the so-called “Staging Area”.
5. Now, having added some changes to the area, it‘s time to truly commit these changes. We‘ll need to add a brief and meaningful message that describes what you really did. The commit will then be recorded in our local Git repository, marking a replacement version of your project.
6. From time to time, we‘ll want to possess a glance at what happened within the project – especially if we‘re working alongside people. The “log” command lists all the commits that were saved in chronological order. This allows us to ascertain which changes were made intimately and helps us comprehend how the project evolved.
7. Also when collaborating with others, we‘ll both want to share (some of) our changes with them and receive the changes they made. a foreign repository on a server is employed to form this exchange possible.