git switch --force vs --discard-changes: docs don't match behavior

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

https://github.com/git/git/blob/683c54c999c301c2cd6f715c411407c413b1d84e/Documentation/git-switch.adoc?plain=1#L115-L124 describes --force as "An alias for `--discard-changes`."

At least on git 2.47.2 though[1], it looks like --force will force more things than --discard-changes:

$ touch Makefile
$ git switch master
error: The following untracked working tree files would be overwritten by checkout:
        Makefile
Please move or remove them before you switch branches.
Aborting
$ git switch --discard-changes master
error: Untracked working tree file 'Makefile' would be overwritten by merge.
$ git switch --force master
branch 'master' set up to track 'origin/master'.
Switched to a new branch 'master'

Is this a bug in the code or documentation?

[1] I searched the mailing list to see if there were any relevant changes since then.




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux