Skip to content

Instantly share code, notes, and snippets.

@filipkral
Created November 1, 2014 19:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save filipkral/f9b8532c3f4e7f87b184 to your computer and use it in GitHub Desktop.
Save filipkral/f9b8532c3f4e7f87b184 to your computer and use it in GitHub Desktop.
Basics of git
# https://confluence.atlassian.com/display/STASH/Basic+Git+commands
# simplest example
git clone https://github.com/some/repo repo
cd repo
# make changes to files
git commit -a -m "Commit message"
# you can check status by `git status`
git push origin master
# to work on a branch
git clone https://github.com/some/repo repo
cd repo
# list all branches with `git branch`
# crate a new branch (leave out -b to switch branches):
git checkout -b mybranch
# make changes to files, add them to git control, and commit:
git add folder/file.py
git commit -a -m "Commit message"
# push branch to remote repo, or all branches git push --all origin
git push origin mybranch
# once the admin merges the branch you can delete it if they didn't
git push origin :mybranch
# you can then delete your local branch after you switch to another one
git branch -d mybranch
# and pull changes from remote repo
git pull
# hopefully there won't be any merge conflicts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment