This will be a reference to most of the git commands I'm familiar with. I'll have separate blog posts for any of them I want to give a deep dive in, also this will be updated accordingly when I learn more commands. For the adventurous kind, you can go to https://git-scm.com/docs for more info.
# git init - This is the command to tell git to start version contol in the current directory.
# git clone - In the scenario where you have an existing git repo in a server somewhere that you have access to. You use this command to clone that repository to your local machine. By default,
git will use the name of the default repo. You can also specify an optional parameter
NEW_NAME_FOR_REPO, this will be the name of the new repo.
git clone URL_TO_GIT_REPO [NEW_NAME_FOR_REPO]
NOTE: You might have to provide some credentials, OR generate SSH keys in order for the clone to succeed. This is so that the server ensures that it's speaking with an authorized user.
# git status - This command is used to check what the current state of the repo is in. This command tells us what files has changed (tracked and untracked). In more advanced cases, it can also give details about the
HEAD of the repo.
# git branch - This command is used to manage branches within a repo. By managing, it can mean, creating, updating metadata, viewing, deleting branches.
# git log - This command is for printing the commits made in the current branch. The latest commit is on top. By default, this will pring all the logs, luckily git has a way to limit the number of output.
git log -NUMBER_OF_LATEST_COMMITS_TO_PRINT
# git add - This command is used to add a file(s) to the stage in other to commit them for versioning.
git add FILE_NAME|FILE_NAME_PATTERN
# git commit - This command is used to store the current changes on stage area. This command requires that you use the
-m to specify the message for the commit. If
-m is omitted, then the default text editor is opened so you can specify your message. You can use single or double quotes to enclose your commit message.
git commit -m "COMMIT_MESSAGE"|'COMMIT_MESSAGE'
# git remote - This command is used to list, add and delete the alliases of the remote repos.
# git push - This command is used to push your local changes to the remote repository.
git push REMOTE_REPO LOCAL_BRANCH
# git pull - This command is used to get data/changes from the remote repo. This command will also try to merge the remote data to the local data.
git pull REMOTE_REPO
# git stash - This command is used to save the current changes for later. This can be useful when you've got some changes you want to put away and get to later.
# git config - This command is used to configure and retrieve both local and global git settings.
# git checkout - This command is used to switch the branch that's being worked on.
# git revert - This command creates a commit that undoes the changes from a previous commit.
# git reset - This command is used to undo changes and commits. This command depending how its used will modify where
HEAD points to. USE WITH CAUTION
# git tag - This command is used to mark important points/commits in the repo.