Git 101/intro

Just a tiny note on installing GIt on Windows box as well on some basic settings and commands to get you started.

So you can download Git from the following location:

https://git-scm.com/downloads

Install should not cause any troubles, but interesting thing is that you may get some localization language configured for your Git GUI without asking this during Setup (no options there) and with no option to change it surfaced in Git GUI. Quick and dirty solution for this is to remove localization file for your respective language (or to rename it). Default file location is:

C:\Program Files (x86)\Git\share\git-gui\lib\msgs

Please refer to related question on stackoverflow.com for other solutions for changing Git GUI language.

Following commands can be used in Git Bash to get you started. Set your user name and email:

$ git config --global user.name "Your Name"

$ git config --global user.email "your_email@example.com"

Use the following to confirm changes you made:

$ git config --list

Next you may want to create a local copy of your repo created on git-hub.com. So first you will need to create a local directory to store your local copy:

$ mkdir ~/repo-name

Next switch to directory you created:

$ cd ~/repo-name

Once there, initialize a local Git repo in this directory:

$ git init

Next point your local repository at the remote repository on the GitHub server:

$ git remote add origin https://github.com/YourUserName/repo-name.git

To check remote origin URL for current repo:

git remote show origin

Next you can clone repo, i.e. create a local copy of it on your computer (in the current folder):

$ git clone https://github.com/YourUserName/repo-name.git

To add files:

git add . adds all new files

git add -u pdates tracking for files that changed names or were deleted

git add -A does both of the previous

You should do this before committing. Committing:

$ git commit -m "Commit description"

Previous command will only update your local repo, not the remote repo on GitHub. And to push saved local commits to GitHub you use:

$ git push

And this one is self-explanatory I guess 🙂 :

$ exit

Leave a Reply

Your email address will not be published. Required fields are marked *