Tagged Questions
1
vote
0answers
16 views
How to checkout a tag with GitPython
In a python script, I try to checkout a tag after cloning a git repository.
I use GitPython 0.3.2.
#!/usr/bin/env python
import git
g = git.Git()
g.clone("user@host:repos")
g = git.Git(repos)
...
1
vote
1answer
15 views
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 ...
0
votes
0answers
39 views
Using (or abusing?) GitPython
I've created a custom widget in wxPython which though not yet perfect, is good enough to add to one of my projects (call this widget v1.). I want to keep working on/experimenting with the widget, but ...
1
vote
3answers
163 views
Finding the first commit on a branch with GitPython
I'm writing a git post-receive hook using Python and Git-Python that gathers information about the commits contained in a push, then updates our bug tracker and IM with a summary. I'm having trouble ...
0
votes
1answer
68 views
GitPython: Determine files that were deleted in a specific commit
Using gitpython, I am trying to get a list of changed paths; that is, of all the added, changed and deleted files.
I can retrieve the changed and added files from the commit:
checkout commit 'X'
...
1
vote
1answer
85 views
How to get count of unpublished commit with GitPython?
With git status I can get information about count of unpublished commits:
ยป git status
# On branch master
# Your branch is ahead of 'origin/master' by 2 commits.
# (use "git push" to ...
1
vote
1answer
149 views
Edit a commit with gitpython
Lets say you're in the terminal, currently sitting at the root of a git repo.
If you've got GitPython installed, you can do this to get the last committed commit, or rather, the commit that HEAD ...
0
votes
0answers
153 views
Git commit from Python with GitPython delete files committed from command line
Here is the code I use to create a new file and commit it :
# We are inside a home-made class, using GitPython
# So self.repo is a Repo() object from GitPython module
def set_content(self, path, ...
2
votes
1answer
162 views
gitpython error when checking if repo is dirty
I receive an error while trying to use gitpython to check if a repository is dirty, i.e. has uncommitted changed to tracked files:
import git
repo = git.Repo('')
print repo.is_dirty()
The error:
...
2
votes
1answer
81 views
gitpython creating zip archive
How can I create an archive with gitpython, I tried the following which creates the file but I can't open it it tells me an error occurred reading archive the archive appears to be invalid or damaged
...
1
vote
1answer
502 views
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 in ...
2
votes
0answers
169 views
GitPython equivalent of “git remote show origin”?
I'm trying to update a Python script that checks the status of a handful of local repositories against remotes from using subprocess to using GitPython. What is the equivalent command in GitPython for ...
2
votes
1answer
357 views
GitPython create local branch from remote branch
I have multiple lab machines and I need to make a copy of my remote branch on my local lab machine. I believe the git bash command for this is:
git checkout -b mybranch origin/mybranch
How do I ...
0
votes
1answer
124 views
How to do a git reset --hard using gitPython?
Well the title is self explanatory. What will be the python code equivalent to running git reset --hard (on terminal) using GitPython module?
1
vote
2answers
438 views
how to automate a push to repo using gitpython
I am trying to make a python script which would check for changes in my git local working folder, and automatically push them to the online repo. Currently only using git manually to do it. I want to ...
2
votes
2answers
266 views
cannot follow the python git tutorials
I have lately installed python-git package, and when trying to follow the tutorials over at the following link, I find that certain methods are missing...
...
3
votes
1answer
546 views
Using GitPython module to get remote HEAD branch
I'm trying to use GitPython to write some Python scripts which I can use it to simplify my daily tasks as I manage many branches.
I'm also quite new for Python when it comes to writing complicated ...
0
votes
1answer
2k views
OSError: [Errno 2] No such file or directory on GitPython
I am using GitPython to fetch a remote repository to my machine. The following code works well on my Ubuntu 12.04 but on my amazon ec2, on a Ubuntu 11.10 server, I get the OSError: [Errno 2] No such ...
3
votes
1answer
353 views
GitPython get tree and blob object by sha
I'm using GitPython with a bare repository and I'm trying to get specific git object by its sha. If I used git directly, I would just do this
git ls-tree sha_of_tree
git show sha_of_blob
Since I'm ...
5
votes
2answers
870 views
git log --follow, the gitpython way
I am trying to access the commit history of a single file as in:
git log --follow -- <filename>
I have to use gitpython, so what I am doing now is:
import git
g = git.Git('repo_dir')
...
2
votes
1answer
592 views
GitPython: get list of remote commits not yet applied
I am writing a Python script to get a list of commits that are about to be applied by a git pull operation. The excellent GitPython library is a great base to start, but the subtle inner workings of ...
0
votes
1answer
166 views
Reverting local changes to a file using GItPython
Is there a way under the GitPython library to revert local changes to a single file?
Under the Git command line I would just use git checkout filename but attempting to do this under the GitPython ...
1
vote
1answer
252 views
Get all commits when pushing to server
I am making a git post-commit hook to post my commit messages to Twitter. I have set up the hook on the server, which means it only runs when I call git push.
To interface with git from python, I am ...
2
votes
1answer
523 views
Git Python Cannot find Commit
I am not able to find a commit that a tag points to by navigating the commit tree. For this specific example, I am using the Tornado Web repository cloned directly from Github.
import sys
import git
...
0
votes
2answers
273 views
Can a bare repository have an index? Is this a bug?
I'm trying to get GitPython 0.3 to commit a file to a repository. Roughly, I'm doing this as follows:
data = ...
istream = repo.odb.store(gitdb.IStream(git.Blob.type, len(data), StringIO(data)))
...