Push to remote
Push to remote repository
Now that we have a remote repository setup, let's see how we can push further modifications from local on to the origin.
Make a new commit
Let us make a small modification to the second file add it to the staging area and commit it to the local repo using the below command:
git commit -am "second file modified"
[master a0d9ab9] second file modified
1 file changed, 1 insertion(+), 1 deletion(-)
Check the status and log
git status
On branch master
Your branch is ahead of 'origin/master' by 1 commit.
(use "git push" to publish your local commits)
git log --oneline
a0d9ab9 (HEAD -> master) second file modified
c7d349f (origin/master) hello modified again
4d7bd7f hello modified
299930d second file added
b1e291c initial contentb
Make another new commit
Let us make another new comment just to get to know the process better
Make a small modification to the same file and commit it using the below commands:
git commit -am "second file modified again"
git status
On branch master
Your branch is ahead of 'origin/master' by 2 commits.
(use "git push" to publish your local commits)
nothing to commit, working tree clean
git log --oneline
f488044 (HEAD -> master) second file modified again
a0d9ab9 second file modified
c7d349f (origin/master) hello modified again
4d7bd7f hello modified
299930d second file added
b1e291c initial content
Push the commits
Now that we have made commits and we are ready to push the code or contents on to the origin, let us issue the below shown command:
git push
git status
On branch master
Your branch is up to date with 'origin/master'.
nothing to commit, working tree clean
git log --oneline
f488044 (HEAD -> master, origin/master) second file modified again
a0d9ab9 second file modified
c7d349f hello modified again
4d7bd7f hello modified
299930d second file added
b1e291c initial content
Our local repo and origin are in sync with each other now.
Last updated