git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Any command to simplify 'git fetch origin && git reset --hard origin/master'?

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Jan 19, 2008, 22:50 UTC
Message-ID
<alpine.LSU.1.00.0801192247280.5731@racer.site>
In-Reply-To
<46dff0320801190603w4f0b2595v495ed10f2a87b0cc@mail.gmail.com>
Hi,
On Sat, 19 Jan 2008, Ping Yin wrote:
Show 16 quoted lines
> On Jan 19, 2008 7:15 PM, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
>
> > On Sat, 19 Jan 2008, Ping Yin wrote:
> >
> > > I often encounter the case that the origin reposotory is rebased and 
> > > i make sure i want to use the origin head as my master Now I have to 
> > > do
> > >	$ git fetch origin && git reset --hard origin/master
> >
> > Just make an alias if you're too lazy to type.
> >
> > Personally, I do not see much sense in it, and it is too dangerous to 
> > bless it with an option to fetch or pull.
>
> Can any alias do this? Since a parameter 'origin' or something should be 
> passed in.
Yes.  Something like
	$ git config alias.imtoolazytotype \
		'!sh -c "git fetch $0 && git reset --hard $0/master"'

See http://git.or.cz/gitwiki/Aliases for more, especially the part about advanced aliases with arguments.

Hth, Dscho

Previous: Ping YinNext: Ping Yin
Message 9 of 10 in “Any command to simplify 'git fetch origin && git reset --hard origin/master'?”
  1. Ping YinJan 19, 2008
  2. David SymondsJan 19, 2008
  3. Junio C HamanoJan 19, 2008
  4. Ping YinJan 19, 2008
  5. Junio C HamanoJan 19, 2008
  6. Ping YinJan 19, 2008
  7. Johannes SchindelinJan 19, 2008
  8. Ping YinJan 19, 2008
  9. Johannes SchindelinJan 19, 2008
  10. Ping YinJan 20, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.