Skip to content

Commit fef547f

Browse files
authored
Merge pull request #801 from Yashkapure06/main
Added git and github basics for web Dev beginners
2 parents 78d907a + e352d4a commit fef547f

File tree

1 file changed

+129
-0
lines changed

1 file changed

+129
-0
lines changed

Git-Basics/README.md

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
## Basics of GIT for web-dev beginners👶
2+
3+
4+
## What is `Git`?
5+
1. Git is a distributed version control system.
6+
2. The entire codebase and history is available on every developer’s computer,
7+
which allows for easy branching and merging.
8+
3. It is used as Version Control System (VCS) for tracking changes in computer files.
9+
10+
* Distributed version control
11+
* Coordinates work between multiple developers
12+
* Who made what changes and when
13+
* Revert back at any time
14+
* Local & remote repos
15+
16+
## CONCEPTS OF GIT
17+
* Keeps track of code history
18+
* Takes "snapshots" of your files
19+
* You decide when to take a snapshot by making a "commit"
20+
* You can visit any snapshot at any time
21+
* You can stage files before committing
22+
23+
### Difference Between Git & GitHub
24+
25+
| Git | GitHub |
26+
| ------- | ----------- |
27+
| Git is a software | GitHub is a cloud service |
28+
| Git is installed locally on the system | GitHub is hosted on the web |
29+
| It is command-line tool | It is a graphical user interface |
30+
| Git is maintained by Linux | GitHub is maintained by Microsoft |
31+
| It is focused on version control and code sharing | It is focused on centralized source code hosting |
32+
| Git is open-source licensed | GitHub includes a free-tier and pay-for-use tier |
33+
| Git was released in 2005 | GitHub was released in 2008 |
34+
35+
36+
## GIT Installation
37+
* Linux(Debian)
38+
`$sudo apt-get install git`
39+
* Linux(Fedora)
40+
`$sudo yum install git`
41+
* [Download](http://git-scm.com/download/mac) for Mac
42+
* [Download](http://git-scm.com/download/win) for Windows
43+
44+
45+
### Installation Process Steps:
46+
1. <img width="500" height="400" src="https://user-images.githubusercontent.com/61585443/190359823-e421b976-515a-4565-990d-2f2e4e62977a.png"/>
47+
2. <img width="500" height="400" src="https://user-images.githubusercontent.com/61585443/190360530-a7bfa681-47f4-4859-9b8a-4120e0cad348.png"/>
48+
3. <img width="500" height="400" src="https://user-images.githubusercontent.com/61585443/190360760-30db7768-19e0-4848-a99d-a6c955e041e2.png"/>
49+
4. <img width="500" height="400" src="https://user-images.githubusercontent.com/61585443/190360896-473e1e54-f083-4b5c-a5f0-539f70469142.png"/>
50+
5. <img width="500" height="400" src="https://user-images.githubusercontent.com/61585443/190361144-bc670a2b-b776-4867-9785-7b509d416fbb.png"/>
51+
6. And then Continue Next > Next > Next > <b>Install</b>
52+
7. <img width="500" height="400" src="https://user-images.githubusercontent.com/61585443/190361548-4b700d85-c7d5-4d26-90e7-e5cc3ce24311.png"/>
53+
54+
55+
56+
57+
58+
59+
60+
### After Installation We need To configure git using git bash
61+
1. `git config --global user.name 'YourName'`
62+
2. `git config --global user.email 'YourEmail'`
63+
___
64+
65+
66+
67+
## Git Commands
68+
___
69+
70+
### Getting & Creating Projects
71+
72+
| Command | Description |
73+
| ------- | ----------- |
74+
| `git init` | Initialize a local Git repository |
75+
| `git clone ssh://[email protected]/[username]/[repository-name].git` | Create a local copy of a remote repository |
76+
77+
### Basic Snapshotting
78+
79+
| Command | Description |
80+
| ------- | ----------- |
81+
| `git status` | Check status |
82+
| `git add [file-name.txt]` | Add a file to the staging area |
83+
| `git add -A` | Add all new and changed files to the staging area |
84+
| `git commit -m "[commit message]"` | Commit changes |
85+
| `git rm -r [file-name.txt]` | Remove a file (or folder) |
86+
| `git push` | Push To Remote Repository |
87+
| `git pull` | Pull Latest Changes From Remote Repository |
88+
89+
### Branching & Merging
90+
91+
| Command | Description |
92+
| ------- | ----------- |
93+
| `git branch` | List branches (the asterisk denotes the current branch) |
94+
| `git branch -a` | List all branches (local and remote) |
95+
| `git branch [branch name]` | Create a new branch |
96+
| `git branch -D [branch name]` | Delete a branch |
97+
| `git push origin --delete [branch name]` | Delete a remote branch |
98+
| `git checkout -b [branch name]` | Create a new branch and switch to it |
99+
| `git checkout -b [branch name] origin/[branch name]` | Clone a remote branch and switch to it |
100+
| `git branch -m [old branch name] [new branch name]` | Rename a local branch |
101+
| `git checkout [branch name]` | Switch to a branch |
102+
| `git checkout -` | Switch to the branch last checked out |
103+
| `git checkout -- [file-name.txt]` | Discard changes to a file |
104+
| `git merge [branch name]` | Merge a branch into the active branch |
105+
| `git merge [source branch] [target branch]` | Merge a branch into a target branch |
106+
| `git stash` | Stash changes in a dirty working directory |
107+
| `git stash clear` | Remove all stashed entries |
108+
109+
### Sharing & Updating Projects
110+
111+
| Command | Description |
112+
| ------- | ----------- |
113+
| `git push origin [branch name]` | Push a branch to your remote repository |
114+
| `git push -u origin [branch name]` | Push changes to remote repository (and remember the branch) |
115+
| `git push` | Push changes to remote repository (remembered branch) |
116+
| `git push origin --delete [branch name]` | Delete a remote branch |
117+
| `git pull` | Update local repository to the newest commit |
118+
| `git pull origin [branch name]` | Pull changes from remote repository |
119+
| `git remote add origin ssh://[email protected]/[username]/[repository-name].git` | Add a remote repository |
120+
| `git remote set-url origin ssh://[email protected]/[username]/[repository-name].git` | Set a repository's origin branch to SSH |
121+
122+
### Inspection & Comparison
123+
124+
| Command | Description |
125+
| ------- | ----------- |
126+
| `git log` | View changes |
127+
| `git log --summary` | View changes (detailed) |
128+
| `git log --oneline` | View changes (briefly) |
129+
| `git diff [source branch] [target branch]` | Preview changes before merging |

0 commit comments

Comments
 (0)