-
Notifications
You must be signed in to change notification settings - Fork 0
/
Git commands basics.txt
32 lines (32 loc) · 1.55 KB
/
Git commands basics.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
---Git commands--
0. git congig --global user.email "Your email" (if u dont use --global , the user detail saved for the repository)
git config --global user.name "Your Name"
1.git version --chek version
1.1 git init --to make repo as git repo
2. git status --to check the status of the files like any unsaved work
3. git add . (or git add -a)-- move files from working area to staging area
4.git commit -m "Version1/2/3" -- to commit the changes in the respective version
5 git log -- to track the logs in repository.
6.Push git--- generate key (use documentation given in git website)
7.Create repo in github
8.use keys to setup the link between local repo and github repo
9.to push the code : git push origin master
10. To pull : git pull origin master
11. to check the differenes iin the file made (before adding it to stage or before using git add . command): git diff index.txt
12.Check diff in staging : git diff --staged
13. revoke cheanges if it is staging area : git reset index.txt
14. ---file again moved to working area(check by using git status)
15.Now to revoke all changes frm file:
git checkout index.txt
---
16 . git add -A -- STAGES ALL
git add . --stages new and modified , without deleted
git add -u :stage modified and deleted , without new
--
17. To contribute to someone else work :
-- download repo
-- do git init
-- git fetch orgin master
-- git merge origin master
-- git push origin master --force ( if error shows like ! [rejected] master -> master (fetch first))
-- after this you will be able to do normally