Git Goodness

Git Goodness

Git good with Git

Git is a free and open source version control system. It can handle everything from small to very large projects with speed and efficiency. Below are just a few snippets of the common Git commands that are useful to know.

Repository Creation

  • git init [project_name] - Create a new local repository
  • git clone [project_url] - Download an existing repository

    Repository Feedback

  • git status - List new or modified files not committed
  • git log - Show full change history

    Dealing with Branches

  • git branch - List all local branches
  • git branch -av - List all local and remote branches
  • git checkout [my_branch] - Switch to a branch
  • git branch [new_branch] - Create a new local branch
  • git branch -d [my_branch - Delete a branch

    Changes in Git

  • git add [file_name] - Stage a file (ready to commit)
  • git add . - stage all changed files
  • git commit -m "some message" - Commit all staged files
  • git commit --amend - Change last commit
  • git reset [file_name] - Unstage file. keeping file changes

    Git Synchronization

  • git fetch --all - Get all updates (branches) from remote repository
  • git pull origin [branch_name] - Update current branch with local changes
  • git push origin [branch_name] - Update remote branch with local changes