Skip to content

Instantly share code, notes, and snippets.

@adeleinr adeleinr/Git Cheatsheet
Last active Sep 5, 2015

Embed
What would you like to do?
Git Cheatsheet
-To have unversioned files add a .gitignore file in project root with name of files to ignore in it.
-------------------------------------------
Error ==> How to solve it
ERROR: adeleinr/SocialCard doesn't exist yet. Did you enter it correctly?
fatal: The remote end hung up unexpectedly
Edit the .git/config
---------------------------------------
Check remotes ==> git remote -v
---------------------------------------
Using another git project inside a cloned project (you cant clone recursively)
This does a fork of the web-boilerplate project so your changes to it dont reflect
in the main project
- git remote add web-boilerplate https://opozo@bitbucket.org/opozo/web-boilerplate.git
- git pull web-boilerplate master
---------------------------------------
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes (e.g. 'git pull') before pushing again.
git push -f (if it is ok to overwrite remote with local copy)
git pull (if you need merge)
---------------------------------------
PUSH CHANGES FOR THE FIRST TIME TO GITHUB/BITBUCKET
$ git remote add origin https://adeleinr@bitbucket.org/adeleinr/heroku-human-experience-boilerplate.git
$ git push -u origin master # to push changes for the first time
CREATING A BRANCH
==================
git branch ==> where you are
git checkout -b thoughts-api ==> create a new branch
do your changes
git commit -a -m "message" ==> you should see your changes in your branch only
Use git checkout master to change to the master branch
git push origin thought-api ==> To upload changes to your branch
git branch -D thoughts-api ==> to delete your branch locally
PULL REQUEST (CODE REVIEW REQUEST)
==================================
Online
CREATE A STAGING ENV TO TEST A CHANGE SOMEONE
HAS PUSHED TO MASTER (BUT BEFORE YOU DECIDE TO MERGE IT TO MASTER)
==================================================================
git clone https://adeleinr@bitbucket.org/adeleinr/heroku-human-experience.git
git checkout -b staging
git pull origin api-test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.