Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8137407
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T11:06:30+00:00 2026-06-06T11:06:30+00:00

When answering Git pull hook script which executes locally , I stumbled upon the

  • 0

When answering “Git pull hook script which executes locally“, I stumbled upon the use-case to alias a built-in git command such as pull or push with an extension. How do I do that?

First thought was:

[alias]
    push = "!echo -n \"really push? [y/n]\";read -s -n 1 really;if [[ $really == \"y\" ]];then git push; else echo \"aborting\"; fi"

This works fine as long as I don’t name my alias push (for example qp or something like that). But as soon as I call it push, it’s somehow ignored.

Is there a git way to expand a built in git command with an alias or do I have to set up an alias in my .bashrc?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T11:06:33+00:00Added an answer on June 6, 2026 at 11:06 am

    Short answer: you can’t.

    Git disallows this explicitly to prevent confusion and shadowing that might affect the invocation of git commands (in scripts, etc.). See the git-config manpage.

    alias.*

    Command aliases for the git(1) command wrapper – e.g. after defining “alias.last = cat-file commit HEAD”, the invocation “git last” is equivalent to “git cat-file commit HEAD”. To avoid confusion and troubles with script usage, aliases that hide existing git commands are ignored. Arguments are split by spaces, the usual shell quoting and escaping is supported. quote pair and a backslash can be used to quote them.

    You could, as you noted, just name your alias something else and use that instead, or do it in bash. However, note that multiword aliases in bash are not possible, so you can’t have an alias for “git push”. Instead you’ll need to use a function — see “Bash: Spaces in alias name” on SuperUser for some hints (you can probably adopt it wholesale).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

While answering a particular question here in SO I stumbled upon a peculiar issue
In answering another question, someone showed me the following tutorial, in which the author
In answering this question , it got me thinking... I often use this pattern:
Before simply answering use SWIG or just write it to a file on disk
Answering another XSLT question on this site, I stumbled on a difference between XSLT
I'm new to versioning systems and trying to decide which one to use. There
For answering questions with JavaScript input i often use Demos on JSFiddle . It
READ FIRST before answering! I have a RESTful service which wraps around the Entity
When answering this question I made some research which really confuses me. I noticed
When answering a question with a suggestion to use GADTs , some questions with

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.