Welcome to our new repo, where we all learn to get good with git 😁
As you all know, using git in a work environment is crucial for a Web Developers workflow. It is even more important when working with others.
I DO NOT claim to know everything there is to know about git, as I have only ever used it in my own personal projects.
The purpose of this repo is for us/we/me/you to learn the basics of using git, both for personal use as well as in a team environment.
- Watch this repo.
- Fork this repo.
- Clone your repo.
If you are an absolute beginner and know nothing about git, then I encourage you to check out these GitHub docs.
These 9 commands are absolutely the BASIC ones you will most likely use for this project repo.
git init;git clone;git add;git commit;git status;git branch;git merge;git pull;git push
I have used these for years and type them a hundred times per day.
-
git initThe subcomand
initis short for "initialize".When you type this command in a new folder, this "initializes" a
gitrepository and begins tracking the files in that folder. It will create a hidden folder called.gitthat contains the directory structure for your project version control.You can now continue working on your project, create, edit, delete, and move files around. As you make changes, you are encouraged to
addandcommmitregularly, so you can always track your progress and create "snapshots" of your code as your project grows.In this screenshot, before I run
git init, I run the commandll. In Linux that command says "List Files". AfterllI rungit initand you see the following when I runllagain, it shows a folder called.gitin the new-test-folder`. -
git cloneThis will make a copy of a remote repo on your local machine. This will contain all the files and folder structure, the entire commit history and the branches.
You have several options when it comes to cloning a repo.
Option 1: Default method
This will clone this repo into a new folder that I chose to name "wtb-get-good-with-git".
When you
cdinto that folder, you will see all the project files and folders.git clone https://github.com/jjaimealeman/wtb-get-good-with-git.git
Option 2: Clone into your own folder root
Create your own folder and run the command there.
git clone https://github.com/jjaimealeman/wtb-get-good-with-git.git .
Option 3: Rename the folder
This will clone this repo into a new folder called "name-of-new-folder".
git clone https://github.com/jjaimealeman/wtb-get-good-with-git.git name-of-new-folder
-
git statusAs you make your changes, and you create & delete files,
gitwill keep track of everything.It will track new files that have not been added. It will track files that have been deleted. And of course it will track files that have been modified.
Here you see that I modified
readme.mdandsrc/index.htmlas shown with a red capital "M" on the left.I also deleted
file-that-i-will-delete.txtandsrc/images/screenshot-git-status.pngas shown with a red capital "D" on the left. -
git addI start with a plain
.htmldocument skeleton and later plan on including some Google Fonts and a nice background image. I decide togit add src/index.htmlbefore I work on the CSS.So I
git statusfollowed bygit add src/index.html -
git commitBefore I begin working on the styles of the homepage, I decide to
git commitmy current progress for the homepage. I could run two separate commands like thisgit add src/index.htmland then dogit commit -m'my commit message'But I sometimes like to put the two together, like this:
git add src/index.html && git commit -m'index.html added H1 and #container with paragraphs'
- 6.
git branch - 7.
git merge - 8.
git pull - 9.
git push





