www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - problem with github

reply Walter Bright <newshound2 digitalmars.com> writes:
Can anyone explain what I am doing wrong? It says my master is the same as the 
remote master, but I cannot push anything. Googling the error message suggests
I 
do a `git pull origin master` which replies with `Your branch is up-to-date
with 
'origin master'.

```
mercury~/forks/dmd defaultInitialize2> git checkout master
Switched to branch 'master'
Your branch is up-to-date with 'origin/master'.
mercury~/forks/dmd master> git pull origin master
 From github.com:WalterBright/dmd
  * branch            master     -> FETCH_HEAD
Already up-to-date.
mercury~/forks/dmd master> git checkout test
Switched to branch 'test'
mercury~/forks/dmd test> git rebase master
Current branch test is up to date.
mercury~/forks/dmd test> git diff master
diff --git a/compiler/src/dmd/parse.d b/compiler/src/dmd/parse.d
index 6b1ca8e..20f792c 100644
--- a/compiler/src/dmd/parse.d
+++ b/compiler/src/dmd/parse.d
   -1,4 +1,4   
-/**
+ /**
   * Takes a token stream from the lexer, and parses it into an abstract syntax 
tree.
   *
   * Specification: $(LINK2 https://dlang.org/spec/grammar.html, D Grammar)
mercury~/forks/dmd test> git push origin test
To git github.com:WalterBright/dmd.git
  ! [rejected]        test -> test (non-fast-forward)
error: failed to push some refs to 'git github.com:WalterBright/dmd.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
mercury~/forks/dmd test>
```
Nov 21
next sibling parent =?UTF-8?B?UsOpbXkgTW91w6t6YQ==?= <remy.moueza gmail.com> writes:
On Saturday, 22 November 2025 at 06:12:29 UTC, Walter Bright 
wrote:
 Can anyone explain what I am doing wrong? It says my master is 
 the same as the remote master, but I cannot push anything. 
 Googling the error message suggests I do a `git pull origin 
 master` which replies with `Your branch is up-to-date with 
 'origin master'.

 ```
 mercury~/forks/dmd defaultInitialize2> git checkout master
 Switched to branch 'master'
 Your branch is up-to-date with 'origin/master'.
 mercury~/forks/dmd master> git pull origin master
 From github.com:WalterBright/dmd
  * branch            master     -> FETCH_HEAD
 Already up-to-date.
 mercury~/forks/dmd master> git checkout test
 Switched to branch 'test'
 mercury~/forks/dmd test> git rebase master
 Current branch test is up to date.
 mercury~/forks/dmd test> git diff master
 diff --git a/compiler/src/dmd/parse.d b/compiler/src/dmd/parse.d
 index 6b1ca8e..20f792c 100644
 --- a/compiler/src/dmd/parse.d
 +++ b/compiler/src/dmd/parse.d
    -1,4 +1,4   
 -/**
 + /**
   * Takes a token stream from the lexer, and parses it into an 
 abstract syntax tree.
   *
   * Specification: $(LINK2 https://dlang.org/spec/grammar.html, 
 D Grammar)
 mercury~/forks/dmd test> git push origin test
 To git github.com:WalterBright/dmd.git
  ! [rejected]        test -> test (non-fast-forward)
 error: failed to push some refs to 
 'git github.com:WalterBright/dmd.git'
 hint: Updates were rejected because the tip of your current 
 branch is behind
 hint: its remote counterpart. Integrate the remote changes (e.g.
 hint: 'git pull ...') before pushing again.
 hint: See the 'Note about fast-forwards' in 'git push --help' 
 for details.
 mercury~/forks/dmd test>
 ```
I cannot tell about the github specifics, however, when in doubt about the state of my branches, I run a variant of `git log -8 --graph --pretty=format:'%h - %d %s <%an>'` which will display a textual representation of the git graph with heads and tags annotated to the listed commits. For many years, this has helped me to quickly figure out what was going wrong with my branches. On the dmd repositories, taking the last 20 entries : ``` git lg -20 * 4d0fc7370b - (HEAD -> master, origin/master, origin/HEAD) fix 2025 07:32:24 +0800) <Rainer Schuetze> 2025 11:40:48 +0800) <Paul Backus> 21 Nov 2025 09:57:17 +0800) <limepoutine> Nov 2025 18:52:22 -0500) <Clouudy> * 162592d992 - Fix Segmentation Fault: `ref return` in struct or 20 Nov 2025 08:13:25 +0800) <Clouudy> * 60982f3307 - Don't elide copy when passing lvalue to value <limepoutine> Clouud9/timespec_get (Wed, 19 Nov 2025 14:46:46 -0500) <Steven Schveighoffer> |\ | * 19974bec5a - Formatting changes (Tue, 18 Nov 2025 14:00:44 -0500) <Clouuday> | * 19ed973e34 - Added 32 and 64 bit versions of timespec and timespec_get for Windows, instead of the erroneous single implementation. (Sun, 16 Nov 2025 15:42:36 -0500) <Clouuday> | * 4b1c85ee61 - Added documentation to specify that timespec_get is C11. Narrowed POSIX imports. (Fri, 14 Nov 2025 13:41:27 -0500) <Clouudy> | * bd8b88c2aa - Newline added at end (Thu, 13 Nov 2025 20:03:35 -0500) <Clouudy> | * fee5843161 - Fixed formatting changes (Thu, 13 Nov 2025 20:01:10 -0500) <Clouudy> | * d469920707 - Added POSIX implementation of timespec_get (Thu, 13 Nov 2025 19:35:16 -0500) <Clouudy> | * 4725065cc6 - Made TIME_UTC the proper value (Thu, 13 Nov 2025 19:33:13 -0500) <Clouudy> | * 2bcd3a4690 - Added Windows implementation of timespec_get (Thu, 13 Nov 2025 18:06:21 -0500) <Clouudy> | * f0a4ef9630 - Merge branch 'dlang:master' into master (Wed, 12 Nov 2025 19:44:02 -0500) <Clouudy> | |\ | * \ 95bc192924 - Merge branch 'dlang:master' into master (Fri, 10 Oct 2025 19:47:21 -0400) <Clouudy> | |\ \ | * | | 976a093850 - Updated so building dmd:frontend doesn't break (Fri, 10 Oct 2025 19:45:22 -0400) <Clouuday> ``` The colored version of the command : `git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cD) %C(bold blue)<%an>%Creset'`
Nov 21
prev sibling next sibling parent reply =?UTF-8?B?UsOpbXkgTW91w6t6YQ==?= <remy.moueza gmail.com> writes:
On Saturday, 22 November 2025 at 06:12:29 UTC, Walter Bright 
wrote:
 Can anyone explain what I am doing wrong? It says my master is 
 the same as the remote master, but I cannot push anything. 
 Googling the error message suggests I do a `git pull origin 
 master` which replies with `Your branch is up-to-date with 
 'origin master'.

 ```
 mercury~/forks/dmd defaultInitialize2> git checkout master
 Switched to branch 'master'
 Your branch is up-to-date with 'origin/master'.
 mercury~/forks/dmd master> git pull origin master
 From github.com:WalterBright/dmd
  * branch            master     -> FETCH_HEAD
 Already up-to-date.
 mercury~/forks/dmd master> git checkout test
 Switched to branch 'test'
 mercury~/forks/dmd test> git rebase master
 Current branch test is up to date.
 mercury~/forks/dmd test> git diff master
 diff --git a/compiler/src/dmd/parse.d b/compiler/src/dmd/parse.d
 index 6b1ca8e..20f792c 100644
 --- a/compiler/src/dmd/parse.d
 +++ b/compiler/src/dmd/parse.d
    -1,4 +1,4   
 -/**
 + /**
   * Takes a token stream from the lexer, and parses it into an 
 abstract syntax tree.
   *
   * Specification: $(LINK2 https://dlang.org/spec/grammar.html, 
 D Grammar)
 mercury~/forks/dmd test> git push origin test
 To git github.com:WalterBright/dmd.git
  ! [rejected]        test -> test (non-fast-forward)
 error: failed to push some refs to 
 'git github.com:WalterBright/dmd.git'
 hint: Updates were rejected because the tip of your current 
 branch is behind
 hint: its remote counterpart. Integrate the remote changes (e.g.
 hint: 'git pull ...') before pushing again.
 hint: See the 'Note about fast-forwards' in 'git push --help' 
 for details.
 mercury~/forks/dmd test>
 ```
Having given more thoughts to it, here are some ideas to try. You may have to ensure pour local branch really tracks the remote one. Check it with `git branch -vv`: > git branch -vv * demo 462f969 [origin/demo] plop master 462f969 [origin/master] plop test 6d046ba [origin/test] test-2 If your test branch is only local or does not track origin/test, set its remote tracking branch with: git branch -u origin/test test Since the remote branch is behind master you need to push force. The `--force-with-lease` option will abort the push if someone else pushed changes since your last pull. git push --force-with-lease
Nov 22
next sibling parent Walter Bright <newshound2 digitalmars.com> writes:
On 11/22/2025 4:29 AM, Rémy Mouëza wrote:
 Having given more thoughts to it, here are some ideas to try.
 
 You may have to ensure pour local branch really tracks the remote one.
 Check it with `git branch -vv`:
 
 
      > git branch -vv
      * demo   462f969 [origin/demo] plop
        master 462f969 [origin/master] plop
        test   6d046ba [origin/test] test-2
 
I get: * test f0a813d test
 If your test branch is only local or does not track origin/test, set its
remote 
 tracking branch with:
 
      git branch -u origin/test test
 
git branch -u origin/test test Branch test set up to track remote branch test from origin.
 Since the remote branch is behind master you need to push force. The 
 `--force-with-lease` option will abort the push if someone else pushed changes 
 since your last pull.
 
      git push --force-with-lease
git push --force-with-lease 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) Counting objects: 517, done. Delta compression using up to 2 threads. Compressing objects: 100% (159/159), done. Writing objects: 100% (184/184), 200.68 KiB | 0 bytes/s, done. Total 184 (delta 130), reused 44 (delta 24) remote: Resolving deltas: 100% (130/130), completed with 75 local objects. To git github.com:WalterBright/dmd.git 87e5024..5e222bf castRef -> castRef c2ba35f..0535bea ctfeArrayEquals -> ctfeArrayEquals 4403d84..cbcd479 defaultInitialize -> defaultInitialize 075a944..dd4fbff defaultInitialize2 -> defaultInitialize2 42e97cc..5f2a14c fix18528 -> fix18528 a17f0c5..9bacf5a fix18528-2 -> fix18528-2 04dd6e0..e853c99 fix20956 -> fix20956 a3a53fa..b60018a fix22127 -> fix22127 5549ca0..e52c933 fix22175 -> fix22175 5fc227a..df367cc fix22367 -> fix22367 f704908..b303c29 fix22638 -> fix22638 d7e8ccb..75e6839 fix23166 -> fix23166 0c86272..235bd1c fix23499 -> fix23499 441885f..629084d fix23913 -> fix23913 ae7fe98..516c256 format87 -> format87 6802789..febca7e initsemArray -> initsemArray 2f9bbb0..208813d isCopyCtor -> isCopyCtor 1d779af..b0c8491 nounderscore -> nounderscore 73158d8..58bcca2 placementNew -> placementNew ad19421..55e9ecb sapply -> sapply 9175aaa..f0a813d test -> test ------------------------ oddly, that last command seemed to work. However, it opened a large number of pull requests. I don't know how to delete all these PRs.
Nov 22
prev sibling parent reply Walter Bright <newshound2 digitalmars.com> writes:
While this did push test to github (finally), it also pushed all my other 
branches. There are about a hundred of them. How do I mass remove them?
Nov 22
parent reply =?UTF-8?B?UsOpbXkgTW91w6t6YQ==?= <remy.moueza gmail.com> writes:
On Sunday, 23 November 2025 at 06:43:27 UTC, Walter Bright wrote:
 While this did push test to github (finally), it also pushed 
 all my other branches. There are about a hundred of them. How 
 do I mass remove them?
Deleting a branch on the remote repository is done with : git push --delete origin remote-branch To delete all the branches your `git push` command created, you may try a bash loop. From the output you mentionned this would look like this : for b in castRef ctfeArrayEquals defaultInitialize defaultInitialize2 fix18528 fix18528-2 fix20956 fix22127 fix22175 fix22367 fix22638 fix23166 fix23499 fix23913 format87 initsemArray isCopyCtor nounderscore placementNew sapply; do git push --delete origin $b done Your `git push` configuration, `push.default` might be set to `matching`. To allow a `git push` command to only send the local branch your on you can configure git with : git config push.default current Otherwise, you will have to specify the local branch: git push origin HEAD I am sorry to have sent you the wrong push command; I never encountered that kind of configuration before. I recall that all my push commands only sent the local branch to the remote. Some reference I found: - https://stackoverflow.com/questions/948354/default-behavior-of-git-push-without-a-branch-specified - https://git-scm.com/docs/git-config#Documentation/git-config.txt-pushdefault
Nov 22
parent reply Walter Bright <newshound2 digitalmars.com> writes:
Thank you. I'll see what I can do. I worry about accidentally deleting branches 
for my open PRs.
Nov 23
parent "Richard (Rikki) Andrew Cattermole" <richard cattermole.co.nz> writes:
On 24/11/2025 7:44 PM, Walter Bright wrote:
 Thank you. I'll see what I can do. I worry about accidentally deleting 
 branches for my open PRs.
You can always backup all the remote branches into a new clone. I.e. https://www.youtube.com/watch?v=qUtb8-CvEoo
Nov 23
prev sibling next sibling parent Steven Schveighoffer <schveiguy gmail.com> writes:
On Saturday, 22 November 2025 at 06:12:29 UTC, Walter Bright 
wrote:
 Can anyone explain what I am doing wrong? It says my master is 
 the same as the remote master, but I cannot push anything. 
 Googling the error message suggests I do a `git pull origin 
 master` which replies with `Your branch is up-to-date with 
 'origin master'.

 [...]
It looks like you have rebased on master. Any time you rebase, you sever the history of the tree, and pushing needs to have the `--force` parameter attached: ``` git push test --force ``` I don't see the `test` branch, so it's hard for me to say what the history looks like. -Steve
Nov 24
prev sibling parent Derek Fawcus <dfawcus+dlang employees.org> writes:
My general recommendation for using git is to be explicit, and 
simple.

Which amongst other things means I don't use pull, but instead 
use fetch and merge.  This also means one does not need to set up 
tracking branches, which can be a source of confusion.

I do however operate with an explicit 'triangular' workflow, 
having a private upstream 'fork' (origin) as a remote, as well as 
a remote for the official publish repo (central).  Then I fetch 
from 'central', push to 'origin' and create for PRs from origin 
to central.  Generally avoiding pushes to 'central' even when I 
do have write/commit perms there.




central/some-branch


want to merge in to




vs the 'central' repo


push origin local-branch:remote-branch )



git rebase --onto central/master CUT-POINT some-feature-branch


some-feature-branch^5 if there are 5 commits in that feature, 
possibly it will be a explicit hash, possibly some other branch
Nov 24