Progressive Full Stack Application Development with Live Projects

Source Code Management

Basics of Git and GitHub

Basics of Git and GitHub

What is Git

Why Git?

Features of Git

What is GitHub

Configuring git for the first time

				
					$ git config --global user.name “”

				
			
				
					$ git config --global user.email “”
				
			

General Git Features

1. Initializing Git

				
					$ git init
				
			

Git now knows that it should watch the folder you initiated it
on. Git creates a hidden folder to keep track of changes..

2. Staging files/Adding files to Git repo

Staged files are files that are ready to be committed to the
repository you are working on.

When you first add files to an empty repository, they are all
untracked. To get Git to track them, you need to stage them, or add
them to the staging environment.

				
					$ git add 
				
			

Staging all files in a folder

				
					$ git add --all
				
			

or

				
					$ git add -A
				
			

Making a Commit

Adding commits keep track of our progress and changes as we
work. Git considers each commit change point or “save point”. It is a
point in the project you can go back to if you find a bug, or want to
make a change.
When we commit, we should always include a message.

				
					$ git commit -m “”

				
			

Git Commit without Stage

Sometimes, when you make small changes, using the staging
environment seems like a waste of time. It is possible to commit
changes directly, skipping the staging environment.

				
					$ git commit -a -m “”
				
			

Status of files and log

				
					$ git status
				
			

Log of a file

Log is used to view the history of commits for a repo.

				
					$ git log
				
			
				
					$ git log --oneline );
				
			

Git Help

If you are having trouble remembering commands or options for commands, you can use Git help. 

See all the available options for the specific command –

				
					$ git  -help
				
			

See all possible commands

				
					$ git help --all
				
			

If you find yourself stuck in the list view, SHIFT + G to jump the end of the list, then q to exit the view.