3. What is Git?
Git is a Version Control System (VCS) designed to make it
easier to have multiple versions of a code base,
sometimes across multiple developers or teams.
It allows you to see changes you make to your code and
easily revert them.
It is NOT GITHUB!
4. Ok, then what is Github?
github.com is a website that hosts git repositories on a
remote server.
Hosting repositories on Github facilitates the sharing of
codebases among teams by providing a GUI to easily fork
or clone repos to a local machine.
By pushing your repositories to Github, you will pretty
much automatically create your own developer portfolio
as well!
5. You can interact with Git using the Graphical User Interface (GUI)
provided by GitHub, or through the Command Line Interface (CLI).
11. Elementary Commands
git config
command for setting information such as name or e-mail address
option –global for setting information globally for all repositories
git init
initializes git repository locally
git clone <repo_url>
command for cloning remote repository from hosting service
git add <file_name>
command for adding specified file to the list of changes to be committed (staging area)
12. Elementary Commands
git commit –m/-a
creates a new commit
commit message is required!
-m for commiting all staged content
–a for not just staged but all modified files
git status
displays difference between current state and last commit
displays all changed files including their states (untracked, modified, staged)
git log
lists the history of commits in the current branch
unique commit identifier
who made the commit
date and time
commit messages
additional information
there are many options for displaying commit history in different formats
13. Working with remote repositories
git fetch
this command copies the commits done in the remote repository to the remote branches
git pull
fetches the remote branch and automatically tries to merge it to the current local branch
git push
makes our local changes visible in remote repository
git merge <branch_name>
merging specified branch with the current one
git branch <new_branch>
command for creating new branch with given name
option –b for switching to new branch
17. git with VS Code
Untracked File Status (U):
Files not yet added to repository.
VS Code displays a U beside the filename.
Unmodified File Status:
Tracked files that have not been changed.
Modified File Status (M):
Tracked files that have been changed.
VS Code displays an M beside the filename
Ignore File Status:
Files that match a pattern or exact match in .gitignore
VS Code grays out the filename.
Staged File Status (A):
Tracked files that have been added.
VS Code displays an A beside the filename.