List Of Commonly Used GitHub Commands
Introduction
In this article, we will see what are the list of commonly used commands in Git. These are the commands which are really useful while working on any project. Hope this will be useful.
1) To initialize GitHub Repository in your local machine project folder:
2) To get the status of files:
3) To configure Username and Password:
4) To clone the repository to your local machine:
Note: Here URL is GitHub Repository URL
5) To add a single file to GitHub:
6) To add all the modified file to GitHub:
7) To commit the changes to GitHub:
8) Get the latest code from the main branch:
9) To pull the latest code from a particular branch:
10) To list all the branches including local and remote:
11) To create a new branch name:
12) To delete a branch:
13) Delete remote branch:
14) To create a new branch and switch to the new branch created:
15) Rename branch (local):
16) To switch a branch:
17) To discard changes of a particular file:
18) Merging branch (active branch):
19) Merging to a target branch:
20) Stash your changes:
21) Remove stash:
22) Show difference:
23) To view the log/changes:
24) Detailed view of log/changes:
25) Brief view of log/changes:
26) Get the help:
27) To go back to the previous commit/changes:
28) List stashed files:
29) Come out of stash (write working from the top of stash stack):
30) Discard stashed changes:
31) Going back to HEAD:
32) Going back to the commit before HEAD:
33) Equivalent to "^":
34) Going back two commits before HEAD:
35) To see the list of available tags:
36) To set the current tag to v0.0.1:
37) To create a new tag:
38) To delete the file from your working directory:
39) To show the metadata and content changes of the specified commit:
40) To delete a branch:
41) To delete a branch forcefully:
Note: This will force deletion of the branch, even if it contains unmerged/unpushed commits.
42) Search the working directory for "add()":
43) List of branches:
44) Undo the changes:
45) To delete a file forcefully:
To get the Git version:
How to add a project to GitHub Repository?
- Create a project on your local machine.
- Create a GitHub Repository
- Open the Git Bash go to the path where the project folder exists and type these commands,
- Now go to GitHub Repository and check your Repository.
Conclusion
In this article, we have seen the list of commonly used Git commands. Hope you find this helpful. In addition to these commands, there are a lot of other commands including different options. Comment below with the commands you frequently use. Thank you
Comments
Post a Comment