Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I set an alias in git for "pull --rebase"?

Tags:

git

alias

I'm using git to create alias with this command:

git config --global alias.pr=pull --rebase

But it reminds me that:

error: invalid key: alias.pr=pull

I also tried:

git config --global alias.pr="pull --rebase"
git config --global alias.pr='pull --rebase'

But neither works.

What's the correct command for it?

like image 823
Freewind Avatar asked Oct 25 '13 02:10

Freewind


People also ask

What is git config pull rebase true?

<branchname>. rebase. Setting this to true means that that particular branch will always pull from its upstream via rebasing, unless git pull --no-rebase is used explicitly.

Does git pull rebase?

Git pull rebase is a method of combining your local unpublished changes with the latest published changes on your remote. Let's say you have a local copy of your project's main branch with unpublished changes, and that branch is one commit behind the origin/main branch.

Is git pull -- rebase the same as git rebase?

Regarding your question: git rebase rebases the branch you want. git pull --rebase performs a fetch + rebase in the branches you pull.

Where do I put git alias?

Your git aliases are often stored per your user's configuration at ~/. gitconfig . You can also manually set aliases using, for example, the command git config alias. s 'status -s' .


1 Answers

Do not use the equals character in your commands, and use quotation marks around the contents you want to provide an alias for, for example:

git config --global alias.pr 'pull --rebase'

Alternatively, you can set up your aliases by directly editing your .gitconfig file. See this link for further information on setting up aliases that include arguments.

like image 93
miqh Avatar answered Oct 11 '22 11:10

miqh