Last active
September 5, 2015 07:04
-
-
Save adeleinr/453832 to your computer and use it in GitHub Desktop.
Git Cheatsheet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-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://[email protected]/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://[email protected]/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://[email protected]/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