forked from iamshaunjp/git-playlist
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gitCommands_kapil.txt
43 lines (43 loc) · 1.69 KB
/
gitCommands_kapil.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
1. git init
2. git status
3. git add -a
4. git commit -m "message for commit"
5. To create Git hub repository: https://github.com/.
6. Push code to this repository: push repo URL.
7. Adding file to git and commit it in one command: git commit -a -m "message"
8. Add a handle to your repo for doing push and fetch
a. Git remote add handlename urlOfRepo
b. Git remote -v
c. Git push handleName branch.
9. Git branch
10. Git branch newFeature
11. Git checkout newfeature
12. Git -rm --cached index.html
13. Git log
14. Git log --oneline.
15. Git Checkout
16. Get revert commit no
17. Git reset commit no --hard
18. Shift+: wq
19. Git branch feature-1
20. To see all branches: git branch -a
21. Git checkout feature-1 to change branch form master to feature-1
22. To delete branch- git branch -D feature-1.// use D if branch is not merged and use d if its merged used d
23. To create a branch and checkout at the same time - git checkout -b feature-c
24. Git push githubUrl master .
25. To add alias for gitHub Url's- git remote add origin githubURL
a. Git push origin master
26. Git clone gitHubUrl
27. :git remote -v
28. For daily work:
a. Git pull origin master
b. Check out new branch: git checkout -b feature-x
c. Git add .
d. Git commit -m "message"// here you don’t to wana to merge your branch with master locally and push to origin this is wrong way of working
e. Instead what you will do push this branch to github and after review you will merge this code.
i. Git push origin feature-x
ii. Create a compare and pull request : leave comments
iii. Create pull request
iv. Assign reviewer
v. Review will review you code and will do merge
You can delete branch later on if you want