-
Notifications
You must be signed in to change notification settings - Fork 0
/
git_exercise_commands.txt
73 lines (52 loc) · 1.87 KB
/
git_exercise_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
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
1. Creating Repository
git init
git add .
git commit -m "first commit"
2. Make some changes -- add some files, change content of some files
touch file1
touch file2
3. commit changes
git add .
git commit -m "files added"
git pull
git push origin master
5. create changes and revert those changes using git when those changes are not added to staging are
Changes done to a file named file2
git checkout -- file2
6. create changes and revert those changes after adding changes to staging area
changes done to a filename file2
git add . - file is added to staging area
git status - file is added to commit
git reset HEAD file2 - git removed to commit from staging area
git checkout -- file2 - changes are reverted
9. Display all commits
git log
10. display a particular commit
git log --grep="first commit"
11. create branches called "feature1" and "feature2" from master.
git branch feature1
git branch feature2
11 . Delete branch "feature2".
git branch -d feature2
12. Make some commits on "feature1".
a new file file3 is created and commited.
13. Make some commits on "master"
a new file file3 is created and committed.
14. merge branch "feature1" in "master"
git merge feature1
15. create branch "feature2"
git branch feature2
15. Make some commits on "feature2".
a new file4 is created
16.Make some commits on branch "master".
file4 is created.
17. rebase branch "master" in "feature2" (make some conflicts by changing same file on same line in both the branches) .
git rebase master
18.
Merge - merges both the file and show the changes specificely.
rebase - shows the changes done by the current branch.
19. Use git stash
git stash
20.create a repository on github for your working repository and push changes on remote repository.
git remote add origin https://github.com/nish1603/git_exercise.git
git push -u origin master