https://github.com/aswinbarath/master-git
Master the concepts of Git with me through a set of tutorials
https://github.com/aswinbarath/master-git
git github
Last synced: about 1 month ago
JSON representation
Master the concepts of Git with me through a set of tutorials
- Host: GitHub
- URL: https://github.com/aswinbarath/master-git
- Owner: AswinBarath
- Created: 2021-09-08T07:33:10.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2021-10-09T10:48:07.000Z (over 4 years ago)
- Last Synced: 2025-07-05T21:40:44.773Z (12 months ago)
- Topics: git, github
- Homepage:
- Size: 9.25 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Master Git
Master the concepts of Git with me through a set of tutorials
---
## What is Git ?
- Distributed Version Control System
## What is GitHub ?
- A GUI for hosting the Git folders/repositories/projects online to share, collaborate and contribute from around the world
- Other Platforms: BitBucket, GitLab
---
## Why are we using Git and GitHub?
- Maintaining the history of the project versions
- To track changes made by each person
- Share the project around the world
---
## Download Git
- [Git for macOS, Windows, Linux/Unix](https://git-scm.com/downloads)
---
## Basic Linux commands
- `ls`
- Lists all the files and folders at present directory
- `ls -a`
- Lists all the hidden files and folders as well
- `ls .git`
- Lists all the files and folders inside `.git` folder
- `mkdir project`
- Create a folder named *project*
- `cd project`
- Changes directory to *project* folder
- `touch names.txt`
- Create a file named *touch.txt*
- `vi names.txt`
- Opens the vim editor for names.txt file
- `cat names.txt`
- Displays all the content in names.txt file
- `rm -rf names.txt`
- Deletes the *names.txt* file
---
## Where does Git store information ?
- The information like history, versions and so on are stored in another folder that git provides us.
- This is known the git repository
- This folder is named *.git*
- In Linux file systems, the folders preceded with `.` are hidden
---
## How does Git store information ?
- At its core, git is like a key value store.
- The Value = Data
- The Key = Hash of the Data
- You can use the key to retrieve the content.
---
## Git Commands
- `git init`
- Initializes empty git repository in the current working directory
- `git status`
- Know more about the changes made in the project
- `git add names.txt`
- Adds *names.txt* file to the staging area
- `git add .`
- Add all of the files in the staging area
- `.` means add all of the files/folders
- `git commit -m "names.txt file added"`
- Commit all the files
- `-m` means to provide a message to the commit
- `git restore --staged names.txt`
- Restores the changes made since previous commit from the staging area
- `git log`
- Displays the entire history of commits
- `git reset` **[hash value of the commit]**
- Removing a commit from the history of a project
- `git stash`
- Save the progress somewhere else *(like a backstage)* and make the present working directory clean
- `git stash pop`
- Bring back the changes saved *(from backstage)*
- `git stash clean`
- Just deletes all the changes saved *(from backstage)*
- `git remote add origin ` **[GitHub Repository URL]**
- Attach local *Git* project to *GitHub* Repository
- `git push origin main`
- Share the changes from local project to remote repository
---
## Analogy to understand Git
- Consider a scenario of a wedding
- 1 The Guests go the stage
- 2 Photographer takes their picture with the couple
- 3 The photos are saved in a wedding album
- Now, assume that the guests who have not taken their picture with couple yet as the **Untracked files**
- 1 Hence we take their picture by bringing them to stage => The untracked files are added to the staging area
- Now, we need to permanently save the picture in history
- 2 Hence the photographer takes their picture with the couple => The staged files
## Resources
- [Learn Branching in Git in an Interactive way](https://learngitbranching.js.org/)
- [Complete Git and GitHub Tutorial](https://youtu.be/apGV9Kg7ics) by Kunal Kushwaha
- [Front end Masters - Git in-depth](https://frontendmasters.com/courses/git-in-depth/) by Nina Zakharenko