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

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.

git remote -v

Step#1 stage

First we need to stage changes by using git add command to include the changes in the commit

git add <file_name>

If you want to stage all changes in the current directory then use following

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:

git commit -m "Your commit message here"

Step#3 push

To push the committed changes to the remote repository use following git

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

post by Pravin


Comments


2nd November comment

2024-11-02 by atul

sample comment on server

2024-11-02 by Pravin