Git status
This document should help with git reference that is needed on a regular basis. We feel that this will act as a cheat sheet for quick reference. We also reviewed a lot to see which makes more sense to use Github or Bitbucket. In the end we decided with Github for many reasons one being how well its integrated with 3rd party. read up here to see other perspectives.
Great article (Github vs bitbucket)
Bitbucket VS. GitHub: It's More Than Just Features | Takipi Blog
Let's go back to 2005 when Bitkeeper, host of the Linux kernel project back then, pulled the trigger and changed its…blog.takipi.com
Stash/Bitbucket is Git repository software. It provides a web interface. The starting page shows all the projects, on which the current user has access. The project page lists all the repositories belonging to the project.
Git Client(For people who prefer client to CLI)
Setup User
git config — global user.name <name>
git config — global user.email <email>
git config — global — edit
Common Git commands
git reset — hard — Remove/ignore local changes and then pull master to overwrite
git status — Lets you know what is changed locally
git stash pop — Do the merge, and than pull the stash. stashing acts as a stack, where you can push changes, and you pop them in reverse order
git init — Transform the current directory into a repository
git clone — copies an existing Git repository (Checkout)
git add <dir> — Stage all changes in <directory> for the next commit
git commit — commit command commits the staged snapshot to the project history.
git log — git log command displays committed snapshots
git checkout master — checkout command serves three distinct functions: checking out files, checking out commits, and checking out branches
HEAD — usually points to master or some other local branch. but when you check out a previous commit, HEAD no longer points to a branch — it points directly to a commit. This is called a “detached HEAD” state
git revert or git reset — undo any undesired changes.
git checkout a1e8fb5 hello.py — Without altering the existing state of your repository you can bring or change an individual file from a different branch
git revert <commit> — Generate a new commit that undoes all of the changes introduced in <commit>, then apply it to the current branch. “safe” way to undo changes
git reset — Reset the staging area to match the most recent commit
git reset — hard — Reset the staging area and the working directory to match the most recent commit. In addition to unstaging changes, the — hard flag tells Git to overwrite all changes in the working directory
git clean -n — removes untracked files from your working directory.
git rebase <base> — Rebasing is the process of moving a branch to a new base commit
git remote — List the remote connections you have to other repositories.
git fetch -The git fetch command imports commits from a remote repository into your local repo.
git push — Pushing is how you transfer commits from your local repository to a remote repo.
git squash — can be used to squash unnecessary commits
git pull origin — Get latest from master
Add a repository to Github
Adding an existing project to GitHub using the command line - User Documentation
Putting your existing work on GitHub can let you share and collaborate in lots of great ways. Warning: Never git add…help.github.com
git init
git add .
git commit -m “rails repo creation for new website”
git remote add origin git@github.com:<github username>/<repository name>.git
git push -u origin master
create pull request — In their simplest form, pull requests are a mechanism for a developer to notify team members that they have completed a feature.
Reference
Learn Enough Git to Be Dangerous
An Introduction to Version Control with Gitwww.learnenough.com
Git - Book
The entire Pro Git book, written by Scott Chacon and Ben Straub and published by Apress, is available here. All content…git-scm.com
Setting up a repository | Atlassian Git Tutorial
Set up a repo: git init creates a new Git repo, git clone copies an existing Git repo and git config configures your…www.atlassian.com
Bitbucket | The Git solution for professional teams
Collaborate on code with inline comments and pull requests. Manage and share your Git repositories to build and ship…bitbucket.org