Skip to content

Instantly share code, notes, and snippets.

@darrell24015
Forked from spences10/github-cheat-sheet.md
Created June 30, 2019 14:36
Show Gist options
  • Save darrell24015/c9318af0fe184ac8ab19a6bb155ad4c1 to your computer and use it in GitHub Desktop.
Save darrell24015/c9318af0fe184ac8ab19a6bb155ad4c1 to your computer and use it in GitHub Desktop.

Revisions

  1. @spences10 spences10 revised this gist Apr 20, 2017. 1 changed file with 14 additions and 0 deletions.
    14 changes: 14 additions & 0 deletions github-cheat-sheet.md
    Original file line number Diff line number Diff line change
    @@ -271,3 +271,17 @@ Rather than use the last part I unstaged the changes in VSCode which I think did
    ```shell
    git config --list --show-origin
    ```

    ## If you want to rename a branch while pointed to any branch, do:

    ```sh
    git branch -m <oldname> <newname>
    ```

    If you want to rename the current branch, you can do:

    ```sh
    git branch -m <newname>
    ```

    A way to remember this, is `-m` is for "move" (or `mv`), which is how you rename files.
  2. @spences10 spences10 revised this gist Apr 20, 2017. 1 changed file with 41 additions and 29 deletions.
    70 changes: 41 additions & 29 deletions github-cheat-sheet.md
    Original file line number Diff line number Diff line change
    @@ -4,21 +4,21 @@ This is just stuff that I have put down that I find I use a lot of the time for

    ## Latest changes from repo to your machine

    ```
    ```shell
    $ git pull
    ```

    ## Add tracking information to your work

    Assuming that you are working on the master branch then

    ```
    ```shell
    $ git branch --set-upstream-to=origin/master
    ```

    You can set it to whatever branch you want to track changes for

    ```
    ```shell
    $ git branch --set-upstream-to=origin/<branch>
    ```

    @@ -36,27 +36,37 @@ This will mean you can just do `git pull` and the latest changes will be pulled

    Fork other users repo in GitHub, then clone to your machine.

    `$ git clone https://github.com/YourUserName/awesome-awesome-repo`
    ```shell
    $ git clone https://github.com/YourUserName/awesome-awesome-repo
    ```

    Add the remote repo

    `$ git remote add upstream https://github.com/OtherUserName/awesome-awesome-repo`
    ```shell
    $ git remote add upstream https://github.com/OtherUserName/awesome-awesome-repo
    ```

    Create your branch

    `$ git branch your-awesome-branch`
    ```shell
    $ git branch your-awesome-branch
    ```

    Check it out

    `$ git checkout your-awesome-branch`
    ```shell
    $ git checkout your-awesome-branch
    ```

    If adding a folder use.

    `$ git add nameOfFolder/\\*`
    ```shell
    $ git add nameOfFolder/\\*
    ```

    Make your commit and push to your new branch.

    ```
    ```shell
    $ git add .
    $ git commit -m 'initial commit'
    $ git push origin your-awesome-branch
    @@ -66,13 +76,15 @@ Manage the rest of the PR via GitHub

    ## Check remotes

    `git remote -v`
    ```shell
    git remote -v
    ```

    ## [Sync a remote fork](https://help.github.com/articles/syncing-a-fork/) on your machine

    First configure the local to point to the remote upstream

    ```
    ```shell
    $ git remote -v
    $ git remote add upstream https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git
    $ git remote -v
    @@ -83,7 +95,7 @@ $ git merge upstream/master

    You then use `git merge` to update any branch on the upstream repository:

    ```
    ```shell
    $ git merge upstream/dev
    ```

    @@ -101,47 +113,47 @@ $ git merge upstream/dev

    Using two factor authentication? Then use the following so you're not adding in your auth token each time you want to `push` your code.

    ```
    ```shell
    git remote set-url origin https://yourgithubuser:[email protected]/yourgithubuser/yourrepo.git
    ```

    ## Change `origin` url

    If you want to change the origin url you can use the `set-url` command

    ```
    ```shell
    git remote set-url origin https://github.com/user/new-repo-name
    ```

    ## [Add code on your machine to new repo](https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/)

    Via terminal navigate to your code folder.

    ```
    ```shell
    $ git init
    ```

    Add your files.

    ```
    ```shell
    $ git add .
    ```

    Adding a folder use the following syntax or it'll get added as a BLOB.

    ```
    ```shell
    $ git add nameOfFolder/\\*
    ```

    Commit to local repo.

    ```
    ```shell
    git commit -m 'some detailed message'
    ```

    To add your files to the remote repo, [first add your remote repo](https://help.github.com/articles/adding-a-remote/)

    ```
    ```shell
    $ git remote add origin [remote repository URL]
    # Sets the new remote
    $ git remote -v
    @@ -151,15 +163,15 @@ $ git push origin master

    ## Delete local branch

    ```
    ```shell
    $ git branch -D use-dotenv
    ```

    ## Merge two repos

    If you want to merge project-a into project-b:

    ```
    ```shell
    cd path/to/project-b
    git remote add project-a path/to/project-a
    git fetch project-a
    @@ -171,21 +183,21 @@ git remote remove project-a

    If you have `.env` files that are tracked by Git and want to ignore them so your API keys don't get added to GitHub use:

    ```
    ```shell
    $ git update-index --assume-unchanged <file>
    ```

    ## Start tracking a previously un-tracked file

    ```
    ```shell
    $ git update-index --no-assume-unchanged <file>
    ```

    ## Cloning a repo from someone else's GitHub and pushing it to a repo on my GitHub

    So you make a clone, make some changes then realise that you need to add it to your GitHub account before making a pull

    ```
    ```shell
    $ git remote -v
    origin https://github.com/OtherUser/OtherUserRepo (fetch)
    origin https://github.com/OtherUser/OtherUserRepo (push)
    @@ -195,19 +207,19 @@ You just need to set the `origin` to yours then add the `upstream` as the origin

    So change `origin` to yours:

    ```
    ```shell
    $ git remote set-url origin http://github.com/YourUser/YourRepo
    ```

    Then add `upsrtream` as theirs:

    ```
    ```shell
    $ git remote add upstream https://github.com/OtherUser/OtherUserRepo
    ```

    Now it should look something like this:

    ```
    ```shell
    $ git remote -v
    origin http://github.com/YourUser/YourRepo (fetch)
    origin http://github.com/YourUser/YourRepo (push)
    @@ -217,7 +229,7 @@ upstream https://github.com/OtherUser/OtherUserRepo (push)

    ## Clone a repo and give it a different name

    ```
    ```shell
    $ git clone https://github.com/user/repoNameYouToChange NameYouWantToGiveToRepo
    ```

    @@ -241,7 +253,7 @@ Read [this](http://stackoverflow.com/questions/34519665/how-to-move-head-back-to

    This was the simplest approach I found:

    ```
    ```shell
    # Checkout the desired branch
    git checkout <branch>

  3. @spences10 spences10 revised this gist Apr 20, 2017. 1 changed file with 7 additions and 1 deletion.
    8 changes: 7 additions & 1 deletion github-cheat-sheet.md
    Original file line number Diff line number Diff line change
    @@ -252,4 +252,10 @@ git revert <commit>
    git push origin <branch>
    ```

    Rather than use the last part I unstaged the changes in VSCode which I think did the same thing.
    Rather than use the last part I unstaged the changes in VSCode which I think did the same thing.

    ## Show `.gitconfig` details

    ```shell
    git config --list --show-origin
    ```
  4. @spences10 spences10 revised this gist Apr 9, 2017. 1 changed file with 19 additions and 0 deletions.
    19 changes: 19 additions & 0 deletions github-cheat-sheet.md
    Original file line number Diff line number Diff line change
    @@ -234,3 +234,22 @@ If you make a trivial change and want to commit `$ git commit -m 'some detailed
    `$ git log -1` is fast and simple.

    `$ git log -1 --pretty=%B` if you need just the commit message and nothing else.

    ## Remove commit from pull request

    Read [this](http://stackoverflow.com/questions/34519665/how-to-move-head-back-to-a-previous-location-detached-head/34519716#34519716) for more detail on how to revert.

    This was the simplest approach I found:

    ```
    # Checkout the desired branch
    git checkout <branch>
    # Undo the desired commit
    git revert <commit>
    # Update the remote with the undo of the code
    git push origin <branch>
    ```

    Rather than use the last part I unstaged the changes in VSCode which I think did the same thing.
  5. @spences10 spences10 revised this gist Apr 8, 2017. 1 changed file with 6 additions and 0 deletions.
    6 changes: 6 additions & 0 deletions github-cheat-sheet.md
    Original file line number Diff line number Diff line change
    @@ -149,6 +149,12 @@ $ git remote -v
    $ git push origin master
    ```

    ## Delete local branch

    ```
    $ git branch -D use-dotenv
    ```

    ## Merge two repos

    If you want to merge project-a into project-b:
  6. @spences10 spences10 revised this gist Apr 5, 2017. 1 changed file with 4 additions and 4 deletions.
    8 changes: 4 additions & 4 deletions github-cheat-sheet.md
    Original file line number Diff line number Diff line change
    @@ -99,7 +99,7 @@ $ git merge upstream/dev

    ## 2fa

    Using two factor autentication? Then use the following so you're not addin in your auth token each time you want to `push` your code.
    Using two factor authentication? Then use the following so you're not adding in your auth token each time you want to `push` your code.

    ```
    git remote set-url origin https://yourgithubuser:[email protected]/yourgithubuser/yourrepo.git
    @@ -163,13 +163,13 @@ git remote remove project-a

    ## Stop tracking a file

    If you have `.env` files that are tracked by Git and want to ignore them so your API keys dont get added to GitHub use:
    If you have `.env` files that are tracked by Git and want to ignore them so your API keys don't get added to GitHub use:

    ```
    $ git update-index --assume-unchanged <file>
    ```

    ## Start tracking a previousley untracked file
    ## Start tracking a previously un-tracked file

    ```
    $ git update-index --no-assume-unchanged <file>
    @@ -199,7 +199,7 @@ Then add `upsrtream` as theirs:
    $ git remote add upstream https://github.com/OtherUser/OtherUserRepo
    ```

    Now it sould look something like this:
    Now it should look something like this:

    ```
    $ git remote -v
  7. @spences10 spences10 revised this gist Apr 5, 2017. 1 changed file with 6 additions and 0 deletions.
    6 changes: 6 additions & 0 deletions github-cheat-sheet.md
    Original file line number Diff line number Diff line change
    @@ -169,6 +169,12 @@ If you have `.env` files that are tracked by Git and want to ignore them so your
    $ git update-index --assume-unchanged <file>
    ```

    ## Start tracking a previousley untracked file

    ```
    $ git update-index --no-assume-unchanged <file>
    ```

    ## Cloning a repo from someone else's GitHub and pushing it to a repo on my GitHub

    So you make a clone, make some changes then realise that you need to add it to your GitHub account before making a pull
  8. @spences10 spences10 revised this gist Mar 27, 2017. 1 changed file with 16 additions and 0 deletions.
    16 changes: 16 additions & 0 deletions github-cheat-sheet.md
    Original file line number Diff line number Diff line change
    @@ -8,6 +8,22 @@ This is just stuff that I have put down that I find I use a lot of the time for
    $ git pull
    ```

    ## Add tracking information to your work

    Assuming that you are working on the master branch then

    ```
    $ git branch --set-upstream-to=origin/master
    ```

    You can set it to whatever branch you want to track changes for

    ```
    $ git branch --set-upstream-to=origin/<branch>
    ```

    This will mean you can just do `git pull` and the latest changes will be pulled to your `origin`

    ## What branch?

    `$ git branch` shows what branch you're on
  9. @spences10 spences10 revised this gist Mar 20, 2017. 1 changed file with 12 additions and 0 deletions.
    12 changes: 12 additions & 0 deletions github-cheat-sheet.md
    Original file line number Diff line number Diff line change
    @@ -133,6 +133,18 @@ $ git remote -v
    $ git push origin master
    ```

    ## Merge two repos

    If you want to merge project-a into project-b:

    ```
    cd path/to/project-b
    git remote add project-a path/to/project-a
    git fetch project-a
    git merge --allow-unrelated-histories project-a/master # or whichever branch you want to merge
    git remote remove project-a
    ```

    ## Stop tracking a file

    If you have `.env` files that are tracked by Git and want to ignore them so your API keys dont get added to GitHub use:
  10. @spences10 spences10 revised this gist Mar 16, 2017. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion github-cheat-sheet.md
    Original file line number Diff line number Diff line change
    @@ -183,7 +183,9 @@ $ git clone https://github.com/user/repoNameYouToChange NameYouWantToGiveToRepo

    ## Using Husky?

    If you are pushing right after a commit, you can use `git push --no-verify` to avoid running all the tests again.
    If you are pushing right after a commit, you can use `$ git push --no-verify` to avoid running all the tests again.

    If you make a trivial change and want to commit `$ git commit -m 'some detailed message' --no-verify` will skip your `precommit` and `prepush` scripts.

    ## How to read last commit comment?

  11. @spences10 spences10 revised this gist Mar 16, 2017. 1 changed file with 3 additions and 15 deletions.
    18 changes: 3 additions & 15 deletions github-cheat-sheet.md
    Original file line number Diff line number Diff line change
    @@ -187,20 +187,8 @@ If you are pushing right after a commit, you can use `git push --no-verify` to a

    ## How to read last commit comment?

    ```
    $ git show
    ```

    is the fastest to type, but shows you the diff as well.
    `$ git show` is the fastest to type, but shows you the diff as well.

    ```
    $ git log -1
    ```

    is fast and simple.

    ```
    $ git log -1 --pretty=%B
    ```
    `$ git log -1` is fast and simple.

    if you need just the commit message and nothing else.
    `$ git log -1 --pretty=%B` if you need just the commit message and nothing else.
  12. @spences10 spences10 revised this gist Mar 15, 2017. 1 changed file with 21 additions and 1 deletion.
    22 changes: 21 additions & 1 deletion github-cheat-sheet.md
    Original file line number Diff line number Diff line change
    @@ -178,9 +178,29 @@ upstream https://github.com/OtherUser/OtherUserRepo (push)
    ## Clone a repo and give it a different name

    ```
    git clone https://github.com/user/repoNameYouToChange NameYouWantToGiveToRepo
    $ git clone https://github.com/user/repoNameYouToChange NameYouWantToGiveToRepo
    ```

    ## Using Husky?

    If you are pushing right after a commit, you can use `git push --no-verify` to avoid running all the tests again.

    ## How to read last commit comment?

    ```
    $ git show
    ```

    is the fastest to type, but shows you the diff as well.

    ```
    $ git log -1
    ```

    is fast and simple.

    ```
    $ git log -1 --pretty=%B
    ```

    if you need just the commit message and nothing else.
  13. @spences10 spences10 revised this gist Mar 15, 2017. 1 changed file with 4 additions and 0 deletions.
    4 changes: 4 additions & 0 deletions github-cheat-sheet.md
    Original file line number Diff line number Diff line change
    @@ -180,3 +180,7 @@ upstream https://github.com/OtherUser/OtherUserRepo (push)
    ```
    git clone https://github.com/user/repoNameYouToChange NameYouWantToGiveToRepo
    ```

    ## Using Husky?

    If you are pushing right after a commit, you can use `git push --no-verify` to avoid running all the tests again.
  14. @spences10 spences10 revised this gist Mar 14, 2017. 1 changed file with 11 additions and 1 deletion.
    12 changes: 11 additions & 1 deletion github-cheat-sheet.md
    Original file line number Diff line number Diff line change
    @@ -52,7 +52,7 @@ Manage the rest of the PR via GitHub

    `git remote -v`

    ## [Sync a remote fork](https://help.github.com/articles/syncing-a-fork/)
    ## [Sync a remote fork](https://help.github.com/articles/syncing-a-fork/) on your machine

    First configure the local to point to the remote upstream

    @@ -71,6 +71,16 @@ You then use `git merge` to update any branch on the upstream repository:
    $ git merge upstream/dev
    ```

    ## Sync a remote fork on Github

    1. Open your fork on GitHub.
    2. Click on Pull Requests.
    3. Click on New Pull Request. By default, GitHub will compare the original with your fork, and there shouldn’t be anything to compare if you didn’t make any changes.
    4. Click on Try `switching the base`. Now GitHub will compare your fork with the original, and you should see all the latest changes.
    5. Click on Click to create a pull request for this comparison and assign a predictable name to your pull request (e.g., Update from original).
    6. Click on Send pull request.
    7. Scroll down and click Merge pull request and finally Confirm merge. If your fork didn’t have any changes, you will be able to merge it automatically.

    ## 2fa

    Using two factor autentication? Then use the following so you're not addin in your auth token each time you want to `push` your code.
  15. @spences10 spences10 revised this gist Mar 13, 2017. 1 changed file with 6 additions and 0 deletions.
    6 changes: 6 additions & 0 deletions github-cheat-sheet.md
    Original file line number Diff line number Diff line change
    @@ -2,6 +2,12 @@

    This is just stuff that I have put down that I find I use a lot of the time for my own reference.

    ## Latest changes from repo to your machine

    ```
    $ git pull
    ```

    ## What branch?

    `$ git branch` shows what branch you're on
  16. @spences10 spences10 revised this gist Mar 13, 2017. 1 changed file with 23 additions and 7 deletions.
    30 changes: 23 additions & 7 deletions github-cheat-sheet.md
    Original file line number Diff line number Diff line change
    @@ -69,25 +69,43 @@ $ git merge upstream/dev

    Using two factor autentication? Then use the following so you're not addin in your auth token each time you want to `push` your code.

    `git remote set-url origin https://yourgithubuser:[email protected]/yourgithubuser/yourrepo.git`
    ```
    git remote set-url origin https://yourgithubuser:[email protected]/yourgithubuser/yourrepo.git
    ```

    ## Change `origin` url

    If you want to change the origin url you can use the `set-url` command

    ```
    git remote set-url origin https://github.com/user/new-repo-name
    ```

    ## [Add code on your machine to new repo](https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/)

    Via terminal navigate to your code folder.

    `$ git init`
    ```
    $ git init
    ```

    Add your files.

    `$ git add .`
    ```
    $ git add .
    ```

    Adding a folder use the following syntax or it'll get added as a BLOB.

    `$ git add nameOfFolder/\\*`
    ```
    $ git add nameOfFolder/\\*
    ```

    Commit to local repo.

    `git commit -m 'some detailed message'`
    ```
    git commit -m 'some detailed message'
    ```

    To add your files to the remote repo, [first add your remote repo](https://help.github.com/articles/adding-a-remote/)

    @@ -143,8 +161,6 @@ upstream https://github.com/OtherUser/OtherUserRepo (push)

    ## Clone a repo and give it a different name



    ```
    git clone https://github.com/user/repoNameYouToChange NameYouWantToGiveToRepo
    ```
  17. @spences10 spences10 revised this gist Mar 1, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion github-cheat-sheet.md
    Original file line number Diff line number Diff line change
    @@ -10,7 +10,7 @@ This is just stuff that I have put down that I find I use a lot of the time for

    `$ git branch -a` shows all branches

    ## Create a PR [Pull Request](https://spences10.github.io/2017/01/05/git-and-github.html)
    ## Create a PR [[Pull Request](https://spences10.github.io/2017/01/05/git-and-github.html)]

    Fork other users repo in GitHub, then clone to your machine.

  18. @spences10 spences10 revised this gist Feb 13, 2017. 1 changed file with 8 additions and 0 deletions.
    8 changes: 8 additions & 0 deletions github-cheat-sheet.md
    Original file line number Diff line number Diff line change
    @@ -140,3 +140,11 @@ origin http://github.com/YourUser/YourRepo (push)
    upstream https://github.com/OtherUser/OtherUserRepo (fetch)
    upstream https://github.com/OtherUser/OtherUserRepo (push)
    ```

    ## Clone a repo and give it a different name



    ```
    git clone https://github.com/user/repoNameYouToChange NameYouWantToGiveToRepo
    ```
  19. @spences10 spences10 revised this gist Feb 9, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion github-cheat-sheet.md
    Original file line number Diff line number Diff line change
    @@ -117,7 +117,7 @@ origin https://github.com/OtherUser/OtherUserRepo (fetch)
    origin https://github.com/OtherUser/OtherUserRepo (push)
    ```

    You just need to the `origin` to yours then add the `upstream` as the original `origin` make sense?
    You just need to set the `origin` to yours then add the `upstream` as the original `origin` make sense?

    So change `origin` to yours:

  20. @spences10 spences10 revised this gist Feb 8, 2017. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions github-cheat-sheet.md
    Original file line number Diff line number Diff line change
    @@ -35,6 +35,7 @@ If adding a folder use.
    Make your commit and push to your new branch.

    ```
    $ git add .
    $ git commit -m 'initial commit'
    $ git push origin your-awesome-branch
    ```
    @@ -133,6 +134,7 @@ $ git remote add upstream https://github.com/OtherUser/OtherUserRepo
    Now it sould look something like this:

    ```
    $ git remote -v
    origin http://github.com/YourUser/YourRepo (fetch)
    origin http://github.com/YourUser/YourRepo (push)
    upstream https://github.com/OtherUser/OtherUserRepo (fetch)
  21. @spences10 spences10 revised this gist Feb 8, 2017. 1 changed file with 7 additions and 0 deletions.
    7 changes: 7 additions & 0 deletions github-cheat-sheet.md
    Original file line number Diff line number Diff line change
    @@ -130,4 +130,11 @@ Then add `upsrtream` as theirs:
    $ git remote add upstream https://github.com/OtherUser/OtherUserRepo
    ```

    Now it sould look something like this:

    ```
    origin http://github.com/YourUser/YourRepo (fetch)
    origin http://github.com/YourUser/YourRepo (push)
    upstream https://github.com/OtherUser/OtherUserRepo (fetch)
    upstream https://github.com/OtherUser/OtherUserRepo (push)
    ```
  22. @spences10 spences10 revised this gist Feb 8, 2017. 1 changed file with 24 additions and 0 deletions.
    24 changes: 24 additions & 0 deletions github-cheat-sheet.md
    Original file line number Diff line number Diff line change
    @@ -106,4 +106,28 @@ If you have `.env` files that are tracked by Git and want to ignore them so your
    $ git update-index --assume-unchanged <file>
    ```

    ## Cloning a repo from someone else's GitHub and pushing it to a repo on my GitHub

    So you make a clone, make some changes then realise that you need to add it to your GitHub account before making a pull

    ```
    $ git remote -v
    origin https://github.com/OtherUser/OtherUserRepo (fetch)
    origin https://github.com/OtherUser/OtherUserRepo (push)
    ```

    You just need to the `origin` to yours then add the `upstream` as the original `origin` make sense?

    So change `origin` to yours:

    ```
    $ git remote set-url origin http://github.com/YourUser/YourRepo
    ```

    Then add `upsrtream` as theirs:

    ```
    $ git remote add upstream https://github.com/OtherUser/OtherUserRepo
    ```


  23. @spences10 spences10 revised this gist Feb 7, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion github-cheat-sheet.md
    Original file line number Diff line number Diff line change
    @@ -100,7 +100,7 @@ $ git push origin master

    ## Stop tracking a file

    If you have `.env` files that are tracked by Git and want to ignore them so your API keys dont get added to GitHubm use:
    If you have `.env` files that are tracked by Git and want to ignore them so your API keys dont get added to GitHub use:

    ```
    $ git update-index --assume-unchanged <file>
  24. @spences10 spences10 revised this gist Feb 7, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion github-cheat-sheet.md
    Original file line number Diff line number Diff line change
    @@ -100,7 +100,7 @@ $ git push origin master

    ## Stop tracking a file

    If you have .env files that are tracked by Git and want to ignore them so your API keys dont get added to GitHubm use:
    If you have `.env` files that are tracked by Git and want to ignore them so your API keys dont get added to GitHubm use:

    ```
    $ git update-index --assume-unchanged <file>
  25. @spences10 spences10 revised this gist Feb 7, 2017. 1 changed file with 7 additions and 0 deletions.
    7 changes: 7 additions & 0 deletions github-cheat-sheet.md
    Original file line number Diff line number Diff line change
    @@ -98,5 +98,12 @@ $ git remote -v
    $ git push origin master
    ```

    ## Stop tracking a file

    If you have .env files that are tracked by Git and want to ignore them so your API keys dont get added to GitHubm use:

    ```
    $ git update-index --assume-unchanged <file>
    ```


  26. @spences10 spences10 revised this gist Feb 1, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion github-cheat-sheet.md
    Original file line number Diff line number Diff line change
    @@ -88,7 +88,7 @@ Commit to local repo.

    `git commit -m 'some detailed message'`

    To add your files to the remote repo, [first add you remote repo](https://help.github.com/articles/adding-a-remote/)
    To add your files to the remote repo, [first add your remote repo](https://help.github.com/articles/adding-a-remote/)

    ```
    $ git remote add origin [remote repository URL]
  27. @spences10 spences10 revised this gist Feb 1, 2017. 1 changed file with 6 additions and 0 deletions.
    6 changes: 6 additions & 0 deletions github-cheat-sheet.md
    Original file line number Diff line number Diff line change
    @@ -58,6 +58,12 @@ $ git checkout master
    $ git merge upstream/master
    ```

    You then use `git merge` to update any branch on the upstream repository:

    ```
    $ git merge upstream/dev
    ```

    ## 2fa

    Using two factor autentication? Then use the following so you're not addin in your auth token each time you want to `push` your code.
  28. @spences10 spences10 revised this gist Jan 9, 2017. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions github-cheat-sheet.md
    Original file line number Diff line number Diff line change
    @@ -60,6 +60,8 @@ $ git merge upstream/master

    ## 2fa

    Using two factor autentication? Then use the following so you're not addin in your auth token each time you want to `push` your code.

    `git remote set-url origin https://yourgithubuser:[email protected]/yourgithubuser/yourrepo.git`

    ## [Add code on your machine to new repo](https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/)
  29. @spences10 spences10 revised this gist Jan 8, 2017. 1 changed file with 8 additions and 0 deletions.
    8 changes: 8 additions & 0 deletions github-cheat-sheet.md
    Original file line number Diff line number Diff line change
    @@ -2,6 +2,14 @@

    This is just stuff that I have put down that I find I use a lot of the time for my own reference.

    ## What branch?

    `$ git branch` shows what branch you're on

    `$ git branch -r` shows remote branches

    `$ git branch -a` shows all branches

    ## Create a PR [Pull Request](https://spences10.github.io/2017/01/05/git-and-github.html)

    Fork other users repo in GitHub, then clone to your machine.
  30. @spences10 spences10 renamed this gist Jan 8, 2017. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.