-
Notifications
You must be signed in to change notification settings - Fork 2
/
git-commands.txt
36 lines (30 loc) · 1.09 KB
/
git-commands.txt
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
git init = intialize repo
git status = show status
git diff = show differnce in before after
git log = show commit history
git log -p = show commit history and changes
git log --stat = show change stat
git show "id" = show perticular change in id
git add "file" = add into stage index
git commit -m "message" = add to permanent
git commit -am "message" = add into stage index & permanent
git push = push into repo
git restore "file" = undo modifide head
.gitignore = folder for ignore extra file/folder
git clone "others git link"
git branch = show all branches and current branch
git branch "Bname" = create new branch
git checkout "Bname" = move to branch
git checkout -b "Bname" = create and move to new branch
git merge "Bname" = merge into master
git branch -d "Bname" = delete branch
>when two branches are merged into master, merge conflicts occures
>after resolving commits, git commit run on master branch
>To add new folder as a repo
Create new repo
Open folder in git
git init
add readme.md and git commit -am "msg"
git remote add origin "sha link"
git branch -M main
git push -u origin master