Giter VIP home page Giter VIP logo

git-sync's People

Contributors

alicederyn avatar

Stargazers

 avatar

Watchers

 avatar  avatar

git-sync's Issues

git-sync can overwrite local changes

If git-sync is run when the user has a PR branch out, with local changes to files, and the PR has merged, the resulting fast-forward (#8) overwrites the local changes.

If the branch is no longer on the commit merged to HEAD, git-sync will still "fast-forward" the branch.

ValueError: too many values to unpack

Running git sync today, I got the error:

Traceback (most recent call last):
  File "~/.local/bin/git-sync", line 8, in <module>
    sys.exit(main())
  File "~/.local/pipx/venvs/git-sync/lib/python3.10/site-packages/git_sync/__init__.py", line 62, in main
    branches = branches_with_remote_upstreams()
  File "~/.local/pipx/venvs/git-sync/lib/python3.10/site-packages/git_sync/__init__.py", line 25, in branches_with_remote_upstreams
    return [
  File "~/.local/pipx/venvs/git-sync/lib/python3.10/site-packages/git_sync/__init__.py", line 27, in <listcomp>
    for name, upstream in (line.split(b" ") for line in raw_bytes.splitlines())
ValueError: too many values to unpack (expected 2)

This is parsing the output of git branch --format="%(refname) %(upstream)"; when I run this, I get the output:

(no branch, rebasing remove.breg.378983)
refs/heads/main refs/remotes/upstream/main
refs/heads/remove.breg.378983 refs/heads/main

This initial line seems to be the problem. A better plumbing command to use appears to be:

git for-each-ref --format="%(refname) %(upstream)" refs/heads

Error if remote upstream has been deleted

If the current branch's upstream is a remote branch, but the remote branch has been deleted, git pull --all fails.

Possible solution: Split the git pull --all command into a fetch and (after verifying the remote branch still exists) a command (tbd) that does the fast-forward of pull.

Current workaround: checkout a different branch before running git-sync.

Support proxies

Our firm has a VPN, and connections to github need to go via a proxy. We don't configure that proxy globally as it is only needed for certain sites. It would be nice if git-sync looked for an environment variable ($GITHUB_PROXY?) and passed it into the GraphQLClient.

Sync main merges with github

It's common when working on a PR to merge in changes to the main branch via the UI, creating a merge commit. It would be great if git-sync would fast-forward those commits into the relevant branch, so that subsequent work on the branch is compatible.

Better failure when syncing with uncommitted changes

If you run git sync with uncommitted changes on a branch with remote changes (e.g. on main with tool-created changes to .gitignore, in my case), you get an error:

error: cannot pull with rebase: You have unstaged changes.
error: please commit or stash them.
Traceback (most recent call last):
...

The issue is that the stack trace is quite long, obscuring the user error and making it look like a tool failure.

Sync squash commits with github

github squash commits aren't understood by git (e.g. git branch -d x will error saying x is not merged). It would be great if git-sync would check github for PR activity associated with the user's branches, and fast-forward any branches to the associated merge commit. This would solve basically every complaint I have about squash commits!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.