GitHub For Beginners: Commit, Push And Go

In our last tutorial you learnt how to clone a GitHub repository into your PC. In this tutorial we will learn how to make basic Github Commit, Push and Go commands using Git GUI for windows.

For testing purpose, we are taking an example of printing some text using PHP code.

Save the code in a file, let’s say git1.php at your PC and upload it into your master repository at GitHub i.e. myinstal/ (you can also create a new file using Create New File button available with the repository on Github.com)

For this, please again go to the GitHub.com to manually upload git1.php (by choose your file or simply drag & drop).

git repository

Enter some description about the file uploaded in text boxes and click Commit changes. File git1.php has now become the part of master repository.

Now, let us again clone the master repository (as described in previous tutorial) to get the git1.php into your local system (delete the previous clone if any already existing with same name).

Now open git1.php on your PC and start making any changes.

Let’s modify the echo statement as – echo “my second git operation” .

Now open Git GUI inside the cloned repository folder. You can see the changes made here clearly in green color (with + sign) whereas the previous code in red color (with – sign) in modified not staged section., as shown in fig.

If changes are not shown automatically then click Rescan button at the bottom.

rescan git

Actually before committing the changes to the remote master repository, any change will have to move from unstaged to staged area. To move the changes from unstaged to staged area, just click the little icon before the changed file (git1.php here) in unstaged section, the file will move into the staged section.

You can also move it back to unstaged section by unchecking the green check box before staged file name, inside staged section.

Github Commit and Push Changes to Master Repository:

Now before commit changes, just give some description about the changes in the text area under Commit Message and then click Commit button.

Next thing is to push the committed changes to master repository located at GitHub.

To push, click Push button below Commit button, a pop up will open to ask for source and destination repositories.

The source is the local master repository (the cloned one) and destination is the Github remote master repository (myinstal) and usually both the values come automatically you just need to click Push button to allow pushing the changes.

git push command

You may be again asked to input the Github username and password for the account, where to push changes.

Again a pop up will come on screen showing some processing for a few second s and finally ends processing the push operation with a success keyword on a green strip. ( and failure in red color if some error).

Also you can verify the completion of Push operation by going back to your Github account. Thanks

Recommended Posts For You

About Manish Kumar

I am PHP web developer and blogger.

View all posts by Manish Kumar

Leave a Comment

Your email address will not be published. Required fields are marked *