简体   繁体   中英

How to git push using git-emacs?

I am using the git-emacs to submit code to github throug Emacs. It is ok for add and commit , but it seems that git-emacs do not support the git push operation. When I type Mx git-push , it responds with "no such command".

You're right, it doesn't. However, magit can push.

Newer versions of Emacs provide the command:

C-x v P

longer version:

M-x vc-push

(as noted by @CAT0). If your version of Emacs doesn't support that command, try:

M-& git push [Enter]

longer version:

M-x async-shell-command [Enter] git push [Enter]

As pointed out by @mariotomo this is better than the synchronous version below because it opens a buffer for the output.

M-! git push [Enter]

longer version:

M-x shell-command [Enter] git push [Enter]

( M- is short for "Meta key" which can be Esc or Alt or Ctrl+[ ).

(and if you're on Windows and hesitate to use the shell which goes to a nasty DOS shell by default, try running Emacs as emacs-w32 from Cygwin, things will be saner).

In emacs 25 (maybe also earlier) there is the command

vc-push

which does exactly what it should. It is bound to Cx v P

This is an unfortunate side effect of the fact the built-in Emacs VCS support( vc-mode ) is mostly built for tools like cvs, subversion, etc that have a totally different workflow. DVCS support was added fairly soon (in Emacs 23). I hope vc-mode will be improved in the near future. Until then...

As @khagler said Magit supports git push . Another solid option for you to explore is Egg .

By git-emacs, you can push in the following way:

  1. Mx git-cmd , which is bound to Cx g . ( In git-status window it is bound to . )
  2. type in push

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM