Skip to content

Instantly share code, notes, and snippets.

@pixelspencil
Last active March 23, 2021 00:03
Show Gist options
  • Select an option

  • Save pixelspencil/1dceb42b0abe15cb64487fd302c01c9a to your computer and use it in GitHub Desktop.

Select an option

Save pixelspencil/1dceb42b0abe15cb64487fd302c01c9a to your computer and use it in GitHub Desktop.

Revisions

  1. pixelspencil renamed this gist Mar 23, 2021. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. pixelspencil revised this gist Mar 16, 2021. 1 changed file with 39 additions and 37 deletions.
    76 changes: 39 additions & 37 deletions readme.md
    Original file line number Diff line number Diff line change
    @@ -10,73 +10,75 @@

    `git clone <https://name-of-the-repository-link>`

    # git branch ------------------------------------------
    ## git branch

    git branch <branch-name>
    `git branch <branch-name>`

    # push the new branch into the remote repository:
    git push -u <remote> <branch-name>
    ## push the new branch into the remote repository:

    # viewing branches:
    git branch or git branch --list
    `git push -u <remote> <branch-name>`

    # deleting a branch:
    git branch -d <branch-name>
    ## viewing branches:

    # git checkout ----------------------------------------
    `git branch or git branch --list`

    git checkout <name-of-your-branch>
    ## deleting a branch:

    # - shortcut command allows to create and switch
    git checkout -b <name-of-your-branch>
    `git branch -d <branch-name>`

    # git status + git log --------------------------------
    ## git checkout

    git status
    `git checkout <name-of-your-branch>`

    git log
    ### shortcut command allows to create and switch

    git log --oneline
    `git checkout -b <name-of-your-branch>`

    # git add ---------------------------------------------
    ## git status

    git add <file>
    `git status`

    ## To add everything at once:
    git add -A
    ## git log

    # git commit ------------------------------------------
    `git log`

    git commit -m "commit message"
    `git log --oneline`

    # git push --------------------------------------------
    ## git add

    git push <remote> <branch-name>
    `git add <file>`

    # if is newly created, then you also need to upload
    # the branch with the following command:
    ### Add everything at once:

    git push --set-upstream <remote> <name-of-your-branch>
    `git add -A`

    # or
    ## git commit

    git push -u origin <branch_name>
    `git commit -m "commit message"`

    # git pull --------------------------------------------
    ## git push

    git pull <remote>
    `git push <remote> <branch-name>`

    # git revert ------------------------------------------
    ### if is newly created, then you also need to upload the branch with the following command:

    git revert XXXXXXX
    `git push --set-upstream <remote> <name-of-your-branch>` **OR** `git push -u origin <branch_name>`

    # git merge -------------------------------------------
    ## git pull

    git checkout dev
    `git pull <remote>`

    git fetch
    ## git revert

    git merge <branch-name>
    `git revert XXXXXXX`

    ## git merge

    `git checkout dev`

    `git fetch`

    `git merge <branch-name>`

    ---

  3. pixelspencil revised this gist Mar 16, 2021. 1 changed file with 7 additions and 2 deletions.
    9 changes: 7 additions & 2 deletions readme.md
    Original file line number Diff line number Diff line change
    @@ -8,7 +8,7 @@

    ## git clone

    git clone <https://name-of-the-repository-link>
    `git clone <https://name-of-the-repository-link>`

    # git branch ------------------------------------------

    @@ -77,4 +77,9 @@ git checkout dev
    git fetch

    git merge <branch-name>
    ```

    ---

    ### Useful links

    [10 important git commands that every developer should know](https://www.freecodecamp.org/news/10-important-git-commands-that-every-developer-should-know/)
  4. pixelspencil revised this gist Mar 16, 2021. 1 changed file with 75 additions and 0 deletions.
    75 changes: 75 additions & 0 deletions readme.md
    Original file line number Diff line number Diff line change
    @@ -3,3 +3,78 @@
    ---

    # GIT 101

    ---

    ## git clone

    git clone <https://name-of-the-repository-link>

    # git branch ------------------------------------------

    git branch <branch-name>

    # push the new branch into the remote repository:
    git push -u <remote> <branch-name>

    # viewing branches:
    git branch or git branch --list

    # deleting a branch:
    git branch -d <branch-name>

    # git checkout ----------------------------------------

    git checkout <name-of-your-branch>

    # - shortcut command allows to create and switch
    git checkout -b <name-of-your-branch>

    # git status + git log --------------------------------

    git status

    git log

    git log --oneline

    # git add ---------------------------------------------

    git add <file>

    ## To add everything at once:
    git add -A

    # git commit ------------------------------------------

    git commit -m "commit message"

    # git push --------------------------------------------

    git push <remote> <branch-name>

    # if is newly created, then you also need to upload
    # the branch with the following command:

    git push --set-upstream <remote> <name-of-your-branch>

    # or

    git push -u origin <branch_name>

    # git pull --------------------------------------------

    git pull <remote>

    # git revert ------------------------------------------

    git revert XXXXXXX

    # git merge -------------------------------------------

    git checkout dev

    git fetch

    git merge <branch-name>
    ```
  5. pixelspencil revised this gist Mar 15, 2021. 1 changed file with 5 additions and 1 deletion.
    6 changes: 5 additions & 1 deletion readme.md
    Original file line number Diff line number Diff line change
    @@ -1 +1,5 @@
    ‎‎​
    - [GIT 101](#git-101)

    ---

    # GIT 101
  6. pixelspencil created this gist Mar 15, 2021.
    1 change: 1 addition & 0 deletions readme.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1 @@
    ‎‎​