6

I am using GitPython library (GitPython Documentation)

The following code is working fine for git pull, but how to use git pull --rebase ?"

import git 

g = git.cmd.Git(git_dir)
g.pull()

is there any function or parameter we need to add for git pull --rebase ?

2 Answers 2

7

Have you tried g.pull("--rebase")

Sign up to request clarification or add additional context in comments.

Comments

4

If you create an origin object like: origin = Remote(repo, 'origin')

You can do: origin.pull(rebase=True)

You can do the same with your git.cmd object g.pull(rebase=True)

1 Comment

Note that there is an issue with GitPython when doing a pull with rebase issue you may want to call the repo.__del__() function after that in case you get a BadName exception

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.