How to add a single file to an existed GitHub repository

So today, after finishing the required editing about my forthcoming published tutorial on JCG, I wanted to push the final compressed project in the corresponding GitHub repository.

Here is a full guide of how he do something like this:

  • Firstly, locate Git Shell to the directory of the local repository
  • Ensure that you have the right “version” of the remote repository by pulling it: git pull
  • Add the file that you wish to push: git add [filename]
  • Commit changes (it is recommended to also submit a commit message, something that can be done with the -m parameter): git commit -m “your commit message”
  • Push changes to the remote repository: git push

And here’s a full screenshot of my effort – yes, you did make it clear; I made a mistake (tried to push without having my repo pulled first) just to demonstrate how helpful is the error handling provided from the shell.

    And a personal statement: Finally, I have to admit that learning Git wasn’t a pain at all.


    Advertisements

    Leave a Reply

    Fill in your details below or click an icon to log in:

    WordPress.com Logo

    You are commenting using your WordPress.com account. Log Out / Change )

    Twitter picture

    You are commenting using your Twitter account. Log Out / Change )

    Facebook photo

    You are commenting using your Facebook account. Log Out / Change )

    Google+ photo

    You are commenting using your Google+ account. Log Out / Change )

    Connecting to %s