Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Version History

« Previous Version 2 Next »

git push

This command Is most commonly used to publish and upload local changes to a remote central repository. If a local repo is connected to a remote repo, local chanages changes should be reflected on the remote repo by executing a git push and one of it's sub-commands. Doing this allows one team member to share the modifications with other remote team members.

Before you begin, create a remote repo on bitbucket, github, gitlab, or a remote repo of your choice. Be sure that not to create a README file or any other content on the remote repo.

The remote should display a message like this

The important command here is the git remote add origin... This connects your local repo to the remote repo.

Start with a fresh directory and initialise it as a git repo - git init

Use the git remote add origin command from your remote repo to connect the local repo to the remote repo. Nothing will change on the remote repo until you perform a git push.

Create/copy the file six_honest_serving_men.txt and populate it with the following text

I keep six honest serving-men
  (They taught me all I knew);
Their names are What and Why and When
  And How and Where and Who.
I send them over land and sea,
  I send them east and west;
But after they have worked for me,
  I give them all a rest.

A poem by Rudyard Kipling

Stage and commit the changes.

Verify the branch you are working (it should be main) with the command git branch

Type the command

git push origin main

Visit your remote repo (you may need to refresh the page). The files on your local system should now be present on your remote repo.

Let’s make some changes and see how they affect the remote repo.

  • No labels