Gives Software Developers the tools to be able to work on a project at the same time
- Git is a version control system
- Used for managing the changes to a project over time.
- Git allows you to decide exactly when you save a version of a project
- GitHub is the website that hosts the Git Repos (folders with Git tracking) online, making it easier to share.
- Repositories (Repos) are folders which contain intentional snapshots of progress called commits.
To get started with Git you need to start by having a GitHub account. Then you would open a new Repo on GitHub to store your project. GitHub would then provide you with a page giving instructions on how to connect to the GitHub Repo. This would be an origin (URL) that gives location of your Repo. To be able to connect to this GitHub Repo through Terminal, you need to have initialized (git init
) a Git repo (working directory) on your computer to connect to the GitHub Repo. You need to be in the (cd working directory) on your terminal while connecting(git remote add origin
). This(git remote add origin
) tells git that I want to add a remote Repo that lives at this origin (URL). If you had committed (git commit -m
) changes already to your local repo then Git would be tracking your changes. At this point, you are ready to push(git push -u origin master
)the changes up to the origin and into the master (branch, default name for branch of your new GitHub repo).
fostertaylor~[master ?+]$ ls
Applications Movies git_homework
Beginners_Guide_to_Git Music git_practice
Desktop Pictures open
Documents Public quotes.txt
Downloads README.md to_do
Library best_animals
fostertaylor~[master ?+]$ cd Beginners_Guide_to_Git
fostertaylor~/Beginners_Guide_to_Git[master ?+]$ git init
Initialized empty Git repository in /Users/fostertaylor/Beginners_Guide_to_Git/.git/
fostertaylor~/Beginners_Guide_to_Git$ touch guide.txt
fostertaylor~/Beginners_Guide_to_Git$ ls
guide.txt
fostertaylor~/Beginners_Guide_to_Git$ git add .
fostertaylor~/Beginners_Guide_to_Git$ git status
On branch master
No commits yet
Changes to be committed:
(use "git rm --cached <file>..." to unstage)
new file: guide.txt
fostertaylor~/Beginners_Guide_to_Git$ git commit -m 'Initial commit'
[master (root-commit) 2113d4c] Initial commit
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 guide.txt
fostertaylor~/Beginners_Guide_to_Git[master]$ git remote add origin https://github.com/foster55f/Beginners_Guide_to_Git.git
fostertaylor~/Beginners_Guide_to_Git[master]$ git push -u origin master
Enumerating objects: 3, done.
Counting objects: 100% (3/3), done.
Writing objects: 100% (3/3), 223 bytes | 223.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To https://github.com/foster55f/Beginners_Guide_to_Git.git
* [new branch] master -> master
Branch 'master' set up to track remote branch 'master' from 'origin'.
fostertaylor~/Beginners_Guide_to_Git[master]$