How To Push Changes From Local Repository To Github
Before pushing the changes, it is good idea to review the changes, this can be done using below command
```bash
git diff
```
use `CTR+z` to exit the diff details.
Before pushing the changes, always verify the remote git repository name to ensure you are not pushing to incorrect location.
```bash
git remote -v
```
### Step#1 stage
First we need to stage changes by using `git add` command to include the changes in the commit
```bash
git add <file_name>
```
If you want to stage all changes in the current directory then use following
```bash
git add .
```
### Step#2 commit
Now once the changes are staged, we need to commit changes. While doing commit, please create a commit with a descriptive message using the git commit command:
```bash
git commit -m "Your commit message here"
```
### Step#3 push
To push the committed changes to the remote repository use following git
```bash
git push origin <branch_name>
```
Here replace `<branch_name>` with the name of the branch you're working on. If you're pushing to the main branch, you can usually omit the branch name
This post is written by Pravin
Tags : Git
Share it :