Here are some helpful hints and tips when working with git.
The below is a curl request you can run from the command line. Just change the user and add the name:
curl -u ‘USERNAME’ https://api.github.com/user/repos -d '{"name”:”REPONAME”}’
Set the remote to the repo on github (add the username sometimes):
git remote add origin https://karava@github.com/karava/testCommandLineCreation.gitcheck the url of the origin:
git remote get-url originReference: https://help.github.com/en/articles/adding-an-existing-project-to-github-using-the-command-line
curl https://api.github.com/users/karava/repos | grep -w '"name"'Alternatively here is a tool that can be used to fetch repositories, submit pull requests, fork repos all from the command-line https://hub.github.com. What are the advantages of git command line tools:
How can you search commits/view commit history, or search view/merge history. For example if you want to go back in time and find out what was done, or what broke what? Or to find how some old code was implemented, or to find some code that was deleted. In particularly how would you find when code you deleted still lived in git?
git clone {url}git fork - creates your own copy of a repogit add (*)git diffgit commitgit commit -am “message” - Will add all the files you have changed and commit them together in one
step. Mygit statusgit pushgit push origin master - Meaning push these changes to the master branchgit pullgit log - will give history of all the commits made previously and their messagesgit reset - rollback and go back to an older versiongit reset — hard origin/master - go back to the latest branch in the git repogit rm --cached {file} - remove file from git repo but keep on disk, don't forget to push, and use -r for recursive in multiple files in a foldergit branch - shows all branches of codegit branch {branch_name}git branch -D {branch_name} - delete branchgit checkoutgit checkout -b {branch_name} - both creates and check-out a new branch at the same timegit merge {branch_name} - switch to master branch and then run this command