Skip to content

Instantly share code, notes, and snippets.

@miku
Last active July 14, 2022 17:21
Show Gist options
  • Select an option

  • Save miku/613ccf7a7030a6f32df1 to your computer and use it in GitHub Desktop.

Select an option

Save miku/613ccf7a7030a6f32df1 to your computer and use it in GitHub Desktop.

Revisions

  1. miku revised this gist Nov 6, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -93,7 +93,7 @@ If you `git push` on a non-tracking branch, you'll get some reminder:
    Please make sure you have the correct access rights
    and the repository exists.

    You could set the upstream during [`git push`](http://git-scm.com/docs/git-push) via (deprecated) `--set-upstream:
    You could set the upstream during [`git push`](http://git-scm.com/docs/git-push) via (deprecated) `--set-upstream`:

    > For every branch that is up to date or successfully pushed, **add upstream (tracking) reference**, used by argument-less git-pull[1] and other commands. For more information, see branch.<name>.merge in git-config[1].
  2. miku revised this gist Nov 6, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -3,7 +3,7 @@ README

    Short excursion into `git --track`, `--set-upstream` and `--set-upstream-to`.

    All examples use `co` for `checkout` and `br` for `branch`.
    All examples use the aliases `co` for `checkout` and `br` for `branch`.

    Setup:

  3. miku revised this gist Nov 6, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -3,7 +3,7 @@ README

    Short excursion into `git --track`, `--set-upstream` and `--set-upstream-to`.

    All examples use `co` for `checkout` and `br` as `branch`.
    All examples use `co` for `checkout` and `br` for `branch`.

    Setup:

  4. miku revised this gist Nov 6, 2014. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -3,6 +3,8 @@ README

    Short excursion into `git --track`, `--set-upstream` and `--set-upstream-to`.

    All examples use `co` for `checkout` and `br` as `branch`.

    Setup:

    $ git clone [email protected]:AKSW/OntoWiki.git
  5. miku revised this gist Nov 6, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -43,7 +43,7 @@ Automatic tracking branches are the default.
    remote = origin
    merge = refs/heads/feature/mobile

    Alternatively, suppress tracking with --no-track:
    Alternatively, suppress tracking with `--no-track`:

    [develop] $ git co --no-track -b feature/mobile origin/feature/mobile
    Switched to a new branch 'feature/mobile'
  6. miku revised this gist Nov 6, 2014. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,8 @@
    README
    ======

    Short excursion into `git --track`, `--set-upstream` and `--set-upstream-to`.

    Setup:

    $ git clone [email protected]:AKSW/OntoWiki.git
  7. miku revised this gist Nov 6, 2014. 1 changed file with 22 additions and 2 deletions.
    24 changes: 22 additions & 2 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -41,7 +41,7 @@ Automatic tracking branches are the default.
    remote = origin
    merge = refs/heads/feature/mobile

    Suppress tracking with --no-track:
    Alternatively, suppress tracking with --no-track:

    [develop] $ git co --no-track -b feature/mobile origin/feature/mobile
    Switched to a new branch 'feature/mobile'
    @@ -89,7 +89,7 @@ If you `git push` on a non-tracking branch, you'll get some reminder:
    Please make sure you have the correct access rights
    and the repository exists.

    You could set the upstream during `git push` via (deprecated) `--set-upstream:
    You could set the upstream during [`git push`](http://git-scm.com/docs/git-push) via (deprecated) `--set-upstream:

    > For every branch that is up to date or successfully pushed, **add upstream (tracking) reference**, used by argument-less git-pull[1] and other commands. For more information, see branch.<name>.merge in git-config[1].
    @@ -112,3 +112,23 @@ Or you have the same effect, by using `git branch --set-upstream-to`:
    [branch "feature/mobile"]
    remote = origin
    merge = refs/heads/feature/mobile

    You can unset the tracking as well:

    [feature/mobile] $ git br --unset-upstream
    [feature/mobile] $ cat .git/config
    [core]
    repositoryformatversion = 0
    filemode = true
    bare = false
    logallrefupdates = true
    [remote "origin"]
    url = [email protected]:AKSW/OntoWiki.git
    fetch = +refs/heads/*:refs/remotes/origin/*
    [branch "develop"]
    remote = origin
    merge = refs/heads/develop
    [branch "master"]
    remote = origin
    merge = refs/heads/master
    [branch "feature/mobile"]
  8. miku revised this gist Nov 6, 2014. 1 changed file with 111 additions and 0 deletions.
    111 changes: 111 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,114 @@
    README
    ======

    Setup:

    $ git clone [email protected]:AKSW/OntoWiki.git
    $ cd OntoWiki

    [develop] $ cat .git/config
    [core]
    repositoryformatversion = 0
    filemode = true
    bare = false
    logallrefupdates = true
    [remote "origin"]
    url = [email protected]:AKSW/OntoWiki.git
    fetch = +refs/heads/*:refs/remotes/origin/*
    [branch "develop"]
    remote = origin
    merge = refs/heads/develop

    Automatic tracking branches are the default.

    [develop] $ git co -b feature/mobile origin/feature/mobile
    Branch feature/mobile set up to track remote branch feature/mobile from origin.
    Switched to a new branch 'feature/mobile'

    [feature/mobile] $ cat .git/config
    [core]
    repositoryformatversion = 0
    filemode = true
    bare = false
    logallrefupdates = true
    [remote "origin"]
    url = [email protected]:AKSW/OntoWiki.git
    fetch = +refs/heads/*:refs/remotes/origin/*
    [branch "develop"]
    remote = origin
    merge = refs/heads/develop
    [branch "feature/mobile"]
    remote = origin
    merge = refs/heads/feature/mobile

    Suppress tracking with --no-track:

    [develop] $ git co --no-track -b feature/mobile origin/feature/mobile
    Switched to a new branch 'feature/mobile'

    [feature/mobile] $ cat .git/config
    [core]
    repositoryformatversion = 0
    filemode = true
    bare = false
    logallrefupdates = true
    [remote "origin"]
    url = [email protected]:AKSW/OntoWiki.git
    fetch = +refs/heads/*:refs/remotes/origin/*
    [branch "develop"]
    remote = origin
    merge = refs/heads/develop

    If you `git push` on a non-tracking branch, you'll get some reminder:

    [feature/mobile] $ git push
    warning: push.default is unset; its implicit value is changing in
    Git 2.0 from 'matching' to 'simple'. To squelch this message
    and maintain the current behavior after the default changes, use:

    git config --global push.default matching

    To squelch this message and adopt the new behavior now, use:

    git config --global push.default simple

    When push.default is set to 'matching', git will push local branches
    to the remote branches that already exist with the same name.

    In Git 2.0, Git will default to the more conservative 'simple'
    behavior, which only pushes the current branch to the corresponding
    remote branch that 'git pull' uses to update the current branch.

    See 'git help config' and search for 'push.default' for further information.
    (the 'simple' mode was introduced in Git 1.7.11. Use the similar mode
    'current' instead of 'simple' if you sometimes use older versions of Git)

    ERROR: Permission to AKSW/OntoWiki.git denied to miku.
    fatal: Could not read from remote repository.

    Please make sure you have the correct access rights
    and the repository exists.

    You could set the upstream during `git push` via (deprecated) `--set-upstream:

    > For every branch that is up to date or successfully pushed, **add upstream (tracking) reference**, used by argument-less git-pull[1] and other commands. For more information, see branch.<name>.merge in git-config[1].
    Or you have the same effect, by using `git branch --set-upstream-to`:

    [feature/mobile] $ git br --set-upstream-to origin/feature/mobile

    [feature/mobile] $ cat .git/config
    [core]
    repositoryformatversion = 0
    filemode = true
    bare = false
    logallrefupdates = true
    [remote "origin"]
    url = [email protected]:AKSW/OntoWiki.git
    fetch = +refs/heads/*:refs/remotes/origin/*
    [branch "develop"]
    remote = origin
    merge = refs/heads/develop
    [branch "feature/mobile"]
    remote = origin
    merge = refs/heads/feature/mobile
  9. miku created this gist Nov 6, 2014.
    3 changes: 3 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,3 @@
    README
    ======