A great way to share and use opensource code is through GitHub. Here are some tips on getting started.
How to update remote Github with changes from local copy
Creating a Github repository is fairly straightforward. Once this is cloned to a local location, you will want to synchronise any changes.
- To synchronise the remote with local, run:
git pull origin master
- To synchronise local with remote, run:
git add .
git commit -m "Added interesting files"
git push origin master
Folders appear greyed out on GitHub
This happens when you push a repository containing folders which in turn have .git files within them. In Git, this is known as a submodule. Typically, a single repository should contain a single .git file located in the top level directory. To fix this, for a submodule named submodule-name, do the following:
- Delete the .git file in submodule-name
git rm --cached submodule-name
git commit -m "Remove submodule entry"
git add submodule-name
git commit -m "Add sub fixed module-name folder"
git push origin master
One thought on “Git cheat guide”