Skip to main content
GitPython

GitPython

  • Stack Exchange

9 answers

gitpython and git diff

I am looking to get only the diff of a file changed from a git repo. Right now, I am using gitpython to actually get the commit objects and the files of git changes, but I want to do a dependency ...

9 answers | Jun 20 at 13:19 by user1816561 on Stack Overflow stackoverflow.com
5 answers

GitPython create and push tags

In a python script, I try to create and push a tag to origin on a git repository. I use gitpython-1.0.2. I am able to checkout an existing tag but have not found how to push a new tag to remote. Many ...

5 answers | Apr 20 at 15:30 by Thzith on Stack Overflow stackoverflow.com
6 answers

gitpython - how to check if a remote branch exists?

I'm new to gitpython and haven't been able to find a reference to this anywhere. What I'm looking to do is something like: If remote branch name exists: do something else: do something else Any ...

6 answers | Mar 21 at 10:41 by Alex Karpov on Stack Overflow stackoverflow.com
5 answers

How can I pull a remote repository with GitPython?

I am trying to find the way to pull a git repository using gitPython. So far this is what I have taken from the official docs here. test_remote = repo.create_remote('test', 'git@server:repo.git') ...

5 answers | Feb 28 at 8:32 by Uuid on Stack Overflow stackoverflow.com
1 answer

git-clean with GitPython

Is there any way to do something like git clean -d -x -f using GitPython? I need to reset working directories and want to get rid of all unversioned files without deleting the whole folder (except ...

1 answers | Feb 27 at 7:56 by Paddre on Stack Overflow stackoverflow.com
7 answers

git executable not found with gitpython: "Bad git executable."

I was trying to clone a git repo with access key, but when I am trying to run it, it throws an exception saying the Git executable cannot be found. But I have installed Git and the in_it.py shows the ...

7 answers | Feb 24 at 14:26 by Madhav Attili on Stack Overflow stackoverflow.com
3 answers

GitPython get list of commits from a repo-branch

I have a Git repository URL and a branch name. Using GitPython, how do I get all the commits from the branch?

3 answers | Feb 24 at 0:30 by intrigued_66 on Stack Overflow stackoverflow.com
2 answers

How can I get head of branch with illegal characters in it

I know you can get the head of a branch directly using it's name (e.g. repo.heads.main). Can you get the head of a branch that has illegal variable characters (e.g. feature-generate-events) directly ...

2 answers | Feb 6 at 16:29 by Stephen Rasku on Stack Overflow stackoverflow.com
2 answers

gitpython: Command syntax for git commit

with using gitpython module, I am writing python script to check git diff --> git add of all modified files one by one. At the end I want to commit all these changes, but I didn't find the exact ...

0 answers

Github access token for Apps

I have a GitHub App configured with a Webhook that listens to Github events. The App is installed on a private repo and has both read and write permissions. git clone ...

2 answers

GitPython - script error - already exists and is not an empty directory

I have a script that makes a clone of the repository I need. This script must be executed every day, i.e. reload data from the repository. There are no problems with cloning itself - the first launch ...

2 answers | Dec 9, 2024 at 15:29 by kostya ivanov on Stack Overflow stackoverflow.com
0 answers

GitPython unable to execute command in existing repository

I am trying to run a script with GitPython, but it seems to only fail when I run from inside the Jenkins automation environment. The error that it gives isn't very helpful (and I haven't been able to ...

2 answers

gitpython - checking if branch is not merged with repo object?

I need to check if branch I'm interested is merged to another branch. With gitpython, I can use its git command object like: import git g = git.Git('/path/to/git/repo') g.branch("--no-merged", "...

2 answers | Nov 6, 2024 at 16:30 by Andrius on Stack Overflow stackoverflow.com
8 answers

Checkout or list remote branches in GitPython

I don't see an option to checkout or list remote/local branches in this module: https://gitpython.readthedocs.io/en/stable/

8 answers | Nov 1, 2024 at 1:27 by Mike on Stack Overflow stackoverflow.com
2 answers

gitpython open a repository from somwhere within the repository

Within a python script which I would like to be able to execute from some arbitrary location within a git repositories working tree, in some arbitrary git repository, and I would like to use GitPython ...

2 answers | Oct 23, 2024 at 11:21 by Spacemoose on Stack Overflow stackoverflow.com
2 answers

GitPython: getting the latest tag of a remote repo

I'd like to be able to check what's the latest tag for a given repo (I'm using CPython here as an example). The following works: g = git.cmd.Git() blob = g.ls_remote('https://github.com/python/...

2 answers | Oct 17, 2024 at 23:33 by ponadto on Stack Overflow stackoverflow.com
0 answers

How to get git patch-id using GitPython?

This is command-line syntax to get patch-id for a commit git show HEAD | git patch-id reference: https://git-scm.com/docs/git-patch-id Q: How can I get the same output using GitPython?

Oct 17, 2024 at 19:30 by Jay Joshi on Stack Overflow stackoverflow.com
4 answers

Get Commit object by hexsha in git-python

I'm trying to find the content of the commits that have been checked in between two specific commits. In git I'd do git rev-list --ancestry-path <older_commit_sha>..<newer_commit_sha>. ...

4 answers | Oct 17, 2024 at 17:18 by Jir on Stack Overflow stackoverflow.com
1 answer

How to automate finding the default branch for each remote?

When I run a git clone to set up a new repo with a remote, I end up with origin/HEAD that I can use to identify the head of the default branch on origin without having to first know what the owner of ...

1 answers | Oct 8, 2024 at 19:33 by BCS on Stack Overflow stackoverflow.com
1 answer

Add safe directory with gitpython

How do I run this git command with gitpython(v2.1.*), please ? git config --global --add safe.directory "some_dir" Couldn't find in doc. I tried this: repo = git.Repo.init(some_dir) config ...

1 answers | Sep 25, 2024 at 9:52 by Ticoincoin on Stack Overflow stackoverflow.com
2 answers

How to install gitpython with, Failed to initialize: Bad git executable

I am trying to install git-python on Windows. I tried to install it using the git command: pip install gitpython It installed just fine and it install in my local app data. The only problem was is ...

2 answers | Sep 6, 2024 at 16:10 by Cyber_Pig_908 on Stack Overflow stackoverflow.com
1 answer

Azure devops throwing stderr: 'fatal: You are not currently on a branch.' when trying to push the code to checked out branch using GitPython library

I am trying to check out a git branch,generate files using python code and then push the changes to the branch using GitPython library Below is the code used repo = git.Repo(...

3 answers

How can I use git python get diffs

I am trying to use GitPython to get me diffs in the format I want. For every file I would like 3 lists. A list of lines that were changed, added, and removed. I've been looking online and at the ...

3 answers | Jul 22, 2024 at 13:56 by Ogen on Stack Overflow stackoverflow.com
2 answers

Reading commits in reverse using GitPython

Is there a way to iterate commits in reverse using the GitPython lib, that is, from the oldest one to the newest, in a similar manner to: >>> from git import Repo >>> repo = ...

2 answers | Jul 11, 2024 at 8:11 by null on Stack Overflow stackoverflow.com
2 answers

How do I use a GitHub access token with GitPython?

I am trying to write a python script that when run, will push files to one of my GitHub repositories. I'm using the package GitPython. I want to use an access token to log in into my GitHub account ...

2 answers | Jun 27, 2024 at 12:22 by polk54 on Stack Overflow stackoverflow.com
1 answer

how to run set-branches at origin in GitPython

I am working with shallow-clone and shallow fetch with GIT repo, There is Git-Python being used in the code In Git-python, what would be equivalent command for the following git cmd command git remote ...

1 answers | Jun 22, 2024 at 1:03 by John Byro on Stack Overflow stackoverflow.com
2 answers

Azure Function - App service plan - Installing git package

I have written an Azure Funciton API(using python runtime) to automate the git checkin process(usin gitPython) for some the work which we are doing. It works fine in my local environment. However, ...

0 answers

Trouble pushing to Git remote using GitPython: "remote unpack failed" and "RPC failed; HTTP 500"

I'm encountering issues when trying to push changes to a Git remote repository using GitPython. I'm receiving two different errors intermittently, and I'm unsure how to resolve them. Error 1 error: ...

4 answers

Git stash push with no modification

Usually when I run: git stash push --all if I don't have any modification, nothing is pushed on the stash. Would it be possible to force a push even in this case, so that git stash push --all ...

4 answers | Mar 15, 2024 at 18:34 by tobiasBora on Stack Overflow stackoverflow.com
5 answers

How to download single file from a git repository using python

I want to download single file from my git repository using python. Currently I am using gitpython lib. Git clone is working fine with below code but I don't want to download entire directory. ...

5 answers | Mar 15, 2024 at 14:23 by Ravi Ranjan on Stack Overflow stackoverflow.com
15 30 50 per page
1 2 3