Commands & Notes git add <FILENAME> to add a single file or git add . to add all files to staging git commit -m “MESSAGE” to commit in one step without entering editor mode Git history commands: git log git log –pretty=oneline git log –pretty=oneline –max-count=2 git log –pretty=oneline –since=’5 minutes ago’ git log –pretty=oneline […]
Create new repo on GitHub Create folders and files locally and use Terminal to push repo up… git init git remote add origin git@github.com:USER/REPO.git git add . git commit git push origin
git checkout master /* switch to master branch */ git reset —hard /* clears local to match origin */ git branch -a /* lists branches */ git checkout BRANCH /* checks out BRANCH branch */
git checkout theirs [file]
Remove a file from the repo via your branch and commit git rm [file]
git diff develop:sports/views.py feature/sports_team_fronts_links:sports/views.py
git reset –hard HEAD~ Fixes the annoying “Your branch is ahead by blahblahblah commits.”
To get back to a specific commit type… git reset –hard fe8ef61119454071e87095e4ff8b24c6833cb0c6 …where “fe8ef61119454071e87095e4ff8b24c6833cb0c6” represents the commit’s SHA number.
Creating a new alias (shortcut) in Terminal… Edit profile vim ~/.bash_profile Create alias alias mynewalias=’does this; and this’ Control+o (or esc) … :wq Save profile source ~/.bash_profile My list of aliases… alias aliasnew=’vim ~/.bash_profile’ alias aliassave=’source ~/.bash_profile’ alias an=’vim ~/.bashrc’ alias as=’source ~/.bashrc’ alias checkcss=’./scripts/verify_css.sh’ alias clear=’pip install -i http://23.20.194.155/simple -r setup/requirements.txt; source virtualenvwrapper.sh’ alias […]