-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGit.txt
62 lines (44 loc) · 1.49 KB
/
Git.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
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
Cloned the repo
1)Master:
git start master and after that git verify works.
2)Commit-one-file:
git add A.txt and then git commit. This puts A.txt on the staging area and then commits it.
3)Commit-one-staged-file:
git reset HEAD — A.txt. This removes A.txt from the staging area and the git commit commits this.
Ignore them:
Touch .gitignore creates a hidden file named .gitignore. Using vim editor I changed its content to
*.exe
*.o
*.jar
libraries/
After this I ran git config --global core.excludesFile ~/.gitignore
To configure the file.
4)Chase branch:
git merge escaped works.
5)Merge conflict:
First merge by git merge another-piece-of-work .
code . To open vs code and then edit the file so it’s just 2+3=5. (You can use vim too).
git add equation.txt ( or git add .) git commit.
This works.
6)Save your work:
git stash
Then changing the txt file thorough vs code. Git stash pop. Adding “Finally, finished it!” And committing worked.
7)Change-branch-history:
git rebase hot-bugfix worked
8)Remove ignored:
git rm ignored.txt worked
9)Case sensitive filename:
git mv File.txt file.txt changes the name of file. Then add . And commit works.
10)Fix typo:
code .
Fix the bug and then git add .
Then git commit -m “Add Hello world” —amend
This worked.
11)Forge date:
git commit —amend —no-edit —date “01/01/1987” worked.
12)Fix old typo:
Git rebase -I HEAD~3
Remove the extra commit
code . => edit the file.
git add .
git rebase —continue and then commit these changes.