forked from discover-devops/DevOps_Workbook
-
Notifications
You must be signed in to change notification settings - Fork 0
/
GIT.yaml
72 lines (46 loc) · 2.66 KB
/
GIT.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
About Version Control
Version control is a system that records changes to a file or set of files over time so that you can recall specific versions later.
Local Version Control Systems
Centralized Version Control Systems
Distributed Version Control Systems
What is Git?
Git is distributed version-control system.
If you want to use Git, you must install it on your local computer and after installation of Git, you can start tracking any changes in any of your
folders on your local computer; and again, for that, you don't require any internet connection and under the hood. Git in fact, is special file system
that allows you to store changes that you make in any folder.
GitHub is repository hosting service, and it allows you to create remote copies of your local Git repositories and more than that, it allows other people to
collaborate on your repositories, download them, change, and so on. Of course, GitHub has many other features. For example, with GitHub, you are able to create website with hosting; with domain, it will be sub-domain of github.io and you will also get free SSL encryption. That is a GitHub.
How Git is Different from other VCS:
============================================
The Three States
Git has three main states that your files can reside in: modified, staged, and committed.
Modified means that you have changed the file but have not committed it to your database yet.
Staged means that you have marked a modified file in its current version to go into your next commit snapshot.
Committed means that the data is safely stored in your local database.
First-Time Git Setup
====================
git config --list --show-origin
git config --global user.name "Kumar S"
git config --global user.email [email protected]
Your default branch name
git config --global init.defaultBranch main
git config --list
Getting Help
===============
$ git help <verb>
$ git <verb> --help
$ man git-<verb>
Getting a Git Repository
=============================
cd /home/user/my_project
git init
This creates a new subdirectory named .git that contains all of your necessary repository files a Git repository skeleton.
At this point, nothing in your project is tracked yet. See Git Internals for more information about exactly what files are contained in the .git directory
you just created.
Remember that each file in your working directory can be in one of two states: tracked or untracked.
Tracked files are files that were in the last snapshot, as well as any newly staged files; they can be unmodified, modified, or staged.
In short, tracked files are files that Git knows about.
Checking the Status of Your Files
Staging Modified Files
Short Status
Ignoring Files