In the previous post I gave a introduction about Git and how to install it. In this video I show you how you can manage your changes, commit them and eventually push them to Github.
Don’t wait any longer! Let’s dive in! 🔥
In order to get your files on Github, we need to add a remote to the local Git repository.
You can add a remote by this command.
git remote add origin http://yourGithubURL
In this case is
origin the name of the remote. But we can name it whatever we like.
It is even possible to have multiple remotes. Just give it a other name,
secondremote for example.
Every repository needs to have proper README.md file. So you can include all the details to install your project.
The file extention “md” stands for Markdown. Markdown is a minimalistic way of writing and adding styling on a very easy way.
Github has created a guide to tell you everything about Markdown and how to use it.
Check local changes
For example we made some changes to our Git repository. But if we want to see all the changes we have to ask Git for the status. You can do that by this command.
Then git will show you the files that are changed, removed or created. But also the files that are staged or not staged yet.
This example is from another project, but shows you how it looks!
But after making a change and checking it, we have to prepare the changes, so we can bind it to a commit.
git add .
Is staging all the files.
If we want to do a specific file, we need to use this command.
git add foldername/filename.js
No we can finally add a commit message to our files. For that we use:
git commit -m "This is our commit message"
Now all our staged changes are bind to this commit.
Push files to remote master
After doing a commit you can push that commit to the remote repo.
I would recommend it! But it is possible to continue with making changes and making more commits, and in the end push everything. But it’s more safe to do it more often.
To push your changes to the remote repository we have to use this command.
git push origin master
In this case “origin” is the name of our remote and “master” is the default branch where we are working on. Next time I will show you more about branches.
So now all our changes are safe in Github 👍
Do you need help?
I hope this second episode/blog helped you with getting your changes to Github (or any other remote repository). If you need any help, please let me know in the comments! I would ❤️ to help you out!
Also published on Medium.