forked from piyush9311/All_About_Github
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Github Commands
73 lines (70 loc) · 2.55 KB
/
Github Commands
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
73
For adding the github username on your git bash terminal
git config -- user.name "..."
For adding the email on your git bash terminal
git config --user.email "..."
For entering into Github
git init
To know about the files which are trackable
git status
To add a particular text file named as x.txt in your repository
git add x.txt
To add all the changes you made in the repository
git add .
To add all the changes you made in the repository, also which are hidden.
git add *
To add some words for commiting the Pull Request
git commit -m ".."
To show the username and email
git config --list --global
To show the user name with their commit lines
git log
To revert back the commited one Pull Request
git revert "commit id"
To make a new branch
git branch new
To come into that branch
git checkout new
To push the branch into the origin
git push -u origin new
To know all about all branches
git branch
To delete the branch after exiting from the current branch in the bash command
git branch -d branch_name
To delete the branch online
git push hyperlink --delete branch_name
Now Steps to Create your own Pull Request
make a new folder in your PC than open your Git bash in that folder
then fork the repository and then clone or download it and copy the link into your git bash terminal
Come to the directory where you want to clone it
git clone <link name>
add or change the specifications as per the desired file in the given directory
check the status using
git status
git add .
git commit -m "Something random related to your pull request"
git push origin master
After this, go to the original repository and add a new pull request
Then compare the branches and finally submit the pull request by adding description about it.
finally, u will got (#113) number ,means your pull request is created
Wonderful, now you have created a PR and let’s wait for merging into the main repository.
More Advance GitHub Commands
To fork the repository
git remote add upstream "url"
Steps to erase the changes you have made in your repository
git fetch upstream
git checkout --track origin/develop
git reset --hard upstream/develop
For creating of a new pull request after the changes you have made
git push -f origin develop
For fork
git remote origin set-url "Url to your fork"
for coming into the brach of the issue 7
git checkout -b fix-issue-7
for pushing the changes in the issue 6
git push -u origin fix-issue-6
Moving to the develop repository
git checkout develop
For reseting the changes you have made in local repository
git reset --hard origin/develop
Coming back to branch of issue 3
git checkout fix-issue-3