Git is the free and open source distributed version control system that's responsible for everything GitHub related that happens locally on our computer.
Git is the most powerful tool in modern development.
1. SETUP
Configuring user information used across all local repositories
git config --global user.name “[firstname lastname]”
> set a name that is identifiable for credit when review version history
git config --global user.email “[valid-email]”
> set an email address that will be associated with each history marker
2. SETUP & INIT
Configuring user information, initializing and cloning repositories
git init
> initialize an existing directory as a Git repository
git clone [url]
> retrieve an entire repository from a hosted location via URL
3. Git Add Command
Add file contents to the index.
git add [file]
>add a file as it looks now to your next commit (stage)
Add all file as it looks now to your next commit
git add*
4. Git diff
Track the changes that have not been staged:
>Track the changes that have staged but not committed:
git diff
Track the changes after committing a file:
git diff HEAD
5. Git Status
Display the state of the working directory and the staging area.
git status
6. Git Commit Command
Record changes to the repository.
Syntax:
> Commit changes to repository
git commit
> Commit changes with message
git commit -m "Commit Message"
7. Git show command
Git show command shows all objects
git show
8. Git Push Command
Update remote refs along with associated objects.
> command to send the changes made on the master branch, to your remote repository.
git push [variable name] master
> Command to push all the branches to the server repository.
git push --all
9. Git Pull Command
Fetch from and integrate with another repository or a local branch.
git pull URL
10.Git Log Command
Shows commit logs.
>Display the most recent commits and the status of the head:
git log
>Display the modified files with location:
git log -p
11. Remove a File
git rm [file]
>delete the file from project and stage the removal for commit
12. Move file to another path
git mv [existing-path] [new-path]
> change an existing file path and stage the move