Skip to content

Instantly share code, notes, and snippets.

@filipkral
Created November 1, 2014 19:04
Show Gist options
  • Select an option

  • Save filipkral/f9b8532c3f4e7f87b184 to your computer and use it in GitHub Desktop.

Select an option

Save filipkral/f9b8532c3f4e7f87b184 to your computer and use it in GitHub Desktop.

Revisions

  1. filipkral created this gist Nov 1, 2014.
    31 changes: 31 additions & 0 deletions GitBasics
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,31 @@
    # 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