GITHUB
1. touch , use this to create a new file
2. rm -rf to remove the folder
3. git status
this command will let us know that someone has made any changes but its not present and visible in the github
4. git add .
this means stagg or add all the file and folder code of that particular
directory, example :- photo is clicked
5. git add rishabh.txt
here we specifically adding only rishabh.txt file changes not all the file changes
6. Previously when we do git status - the file is red which is changed but now after adding git add , file color changes to green
7. git log
To check about the repo owner and all other info of commits
8. git commit -m "rishabh.txt added"
-m means message, this is for maintaing the history of your changes
9. vi rishabh.txt
to open the file in vim
10. cat rishabh.txt
It basically display all the text in rishabh.txt
11. git restore --staged rishabh.txt
this is for, if you do mistakenly git add and then you don't want to commit and and remove it from git add you can do the above command
12. git reset adcd4303843084dfofjdo
when we do git log we will get the history of the commits and above there is a unique code of commit, and we want that when I did that particular commit, uske baad jo commit kiye sb remove ho jaye then we have to run above command
13. git stash
Let say if you do some changes in a file and you do git add . but you don't want to commit that so you can do this by git stash, now if check git status you see nothing that need to be commited
14. git stash pop
now if you want that all the changes which I did come back and view in git status as not viewing by doing git stash, we can run above command
15. git stash clear
If we never want that code to come back, we can use git stash clear
16. git remote add origin pathname.git
if you want your project to connect with the github repo, then you can do the same
17. git remote -v
this will tells us which url of github is attached with current project folder
18. git push origin master
To push the changes to your github in the master branch you can use above command
19. git branch rishabh
Branch name rishabh get created, whenever you are working on new code or new feature try to do in new branch
20. git checkout rishabh
This means all the changes you will made now go to the rishabh branch
21. git merge rishabh
now if my code is finalised of that rishabh branch and we want to merge this code in main branch we can do this by above command
22. What does it mean by Fork in github?
so if someone code is public and we want to work on that particular code as that code are their and we don't have right to make change on that code so what we can do is we can fork it so that the clone of that particular project comes to our repo and we can work on them. as this is the clone of the project so whatever change we do this will not reflected in their account, this will reflect in our github account, if their orginasation made the pull request then our code will be reflected in their application
23. git remote add upstream
this means from where we have forked this project, and we want to add the project url of that organisation in our current project, we can use the above command, so when we do git remote -v , that organisation link will be also displayed
24.
Comments
Post a Comment