Repository navigation
Basic Git Commands
Matt Brown edited this page Jan 13, 2021
·
2 revisions
git config --global user.name "John Doe"
git config --global user.email "j.doe@eggplant.io"
git init
git clone <remote_path> // you will need an SSL key configured to use the SSL path
git remote -v // lists the names of any remotes for both fetching and pushing
git checkout <existing_branch_name> // updates project to reflect latest known status of specified branch
git checkout -b <branch_name> // creates a new branch from current branch/state with specified name
git add --all // stages ALL files
git add . // stages all files from present working directory recursively
git add <path_to_file> // stages a specific file
git commit // enters VIM (by default) to allow for longer commit messages
git commit -m "<message>" // short form; useful for small commit messages
git push // pushes committed changes corresponding up-stream branch on remote repo
git push --set-upstream <remote> <branch_name> // sets an upstream branch on remote repo for tracking changes; required for new branches
git push -u <remote> <branch_name> // shortcut for the above command
git log // displays branch commit history including author, date and commit message; press Q to exit
git log --no-decorate --oneline --graph // displays an abbreviated history with helpful graph
git diff // displays differences between unstaged changes and most recent commit on branch
git diff --staged // includes staged changes in comparison to most recent commit on branch
git stash -u // stashes all changes to current working directory; reverts to previous commit
git stash pop // removes last stash from array and applies changes to current working directory
For any comments or concerns about the content within the documents or repo projects, please email James Gahan.