-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGIT COMMANDS.txt.bak
More file actions
105 lines (69 loc) · 2.61 KB
/
GIT COMMANDS.txt.bak
File metadata and controls
105 lines (69 loc) · 2.61 KB
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
GIT COMMANDS
Git is software for tracking changes in any set of files, usually used for coordinating work among programmers collaboratively developing source code during software development. Its goals include speed, data integrity, and support for distributed, non-linear workflows (thousands of parallel branches running on different systems). Git was created by Linus Torvalds in 2005
git has three layers
working area - staging area(git add .) - commit (git commit -m)
git --version
git status
git init
Initialized empty Git repository in D:/NILESH_STUDY_DOCUMENTS/.git/
to bring to staging area
git add .
git commit -m "gitdocs added"
Author identity unknown
*** Please tell me who you are.
Run
git config --global user.email "komal.gupta892@gmail.com"
git config --global user.name "nilesh kumar"
to set your account's default identity.
Omit --global to set the identity only in this repository.
fatal: unable to auto-detect email address (got 'nitis@LAPTOP-42GI1SA5.(none)')
good one
git log
or create a new repository on the command line
echo "# my-git-tutorial" >> README.md
git init
git add README.md
git commit -m "first commit"
git branch -M main
git remote add origin git@github.com:Niljay892/my-git-tutorial.git
git push -u origin main
…or push an existing repository from the command line
git remote add origin https://github.com/Niljay892/my-git-tutorial.git
git branch -M main
git push -u origin main
generating ssh key
ssh-keygen -t rsa -b 4096 -C "komal.gupta892@gmail.com"
# start the ssh-agent in the background
$ eval "$(ssh-agent -s)"
> Agent pid 59566
Add your SSH private key to the ssh-agent
ssh-add ~/.ssh/id_rsa
$ clip < ~/.ssh/id_rsa.pub
# Copies the contents of the id_ed25519.pub file to your clipboard
git pull origin main
to find diff
git diff test.txt
git diff
satgged file diff
git diff --staged test.txt
to unstage file
git reset test.txt
git checkout test.txt :- to go to old commit
for present directory :- git checkout .
staging
git add -A :- stages all
git add . stages new and modified ,without deleted
git add -u stages modified and deleted , without new
cloning a git repository
git clone git@github.com:Niljay892/my-git-tutorial.git :- it makes new folder
git clone git@github.com:Niljay892/my-git-tutorial.git . :- it makes repository.
to ignore a file in git
touch .gitignore :- create this file.
open .gitignore files
##*.pyc : -these are compiled python files used for enhanchement
to ignore files
add directly file name in file
to untrack already checked in file
git rm --cached FILENAME
to make global .gitignore
git config --global core.excludesfile ~/.gitignore_global