unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Yuri Khan <yuri.v.khan@gmail.com>
To: Alan Mackenzie <acm@muc.de>
Cc: Emacs developers <emacs-devel@gnu.org>,
	David Caldwell <david@porkrind.org>
Subject: Re: git pull fails with merge conflicts. How can this possibly happen?
Date: Sat, 15 Nov 2014 12:41:12 +0700	[thread overview]
Message-ID: <CAP_d_8WHBjrLGS8VZpM2JykLfJxBksx5-O6k9Gybbh7u9DJT5A@mail.gmail.com> (raw)
In-Reply-To: <20141114215404.GD3168@acm.acm>

On Sat, Nov 15, 2014 at 3:54 AM, Alan Mackenzie <acm@muc.de> wrote:

> gitk doesn't work on my system, of course.  (Nothing ever does without a
> lot of effort).

I want to propose a couple of rules of thumb for beginner Git users.


Rule First:

* Drop everything else you’re trying to do with Git and get
comfortable with at least one Git repository browser. One that
displays pretty graphs.

Starting with Git without a graph browser is like learning chess by
playing blind.

At a minimum, this command is always available:

$ git log --graph --decorate --oneline --color <branch>…


Rule Second:

* Do not ever use “git pull”.

“git pull” does two things. First, it will bring into your local
repository new commits[1] from the remote, and rearrange the remote
tracking branch heads[2] to match their current positions in the
remote. Second, it will try to match[3] your local branch head with a
remote tracking branch head, and merge that into your local branch.

[1] This set of commits is unpredictable and depends on the past
actions of many other people.
[2] The motion of remote tracking branches is unpredictable and
depends on the past actions of many other people.
[3] The matching of the local branch to the corresponding remote
tracking branch is predictable and depends only on your own actions.
But still it is often surprising.

Instead:

1. Cautiously “git fetch” new remote state into your local repo.
2. Explore the changes with a graph browser, at least for the few
branches you are directly interested in (emacs-24 and master). See if
any of the remote branches diverged with your local branches.
3. Decide if you want a merge, a rebase, a cherry-pick, or something
else entirely. (I have seen cases when the remote had changed so much
that it was easier to reimplement a feature on top of the new remote
state than try to merge or rebase.)


Also, required reading/watching:

* Git Pro, book by Scott Chacon
* Git For Ages 4 and Up, talk by Michael Schwern


> Funny thing: looking at the gitk man page, there doesn't
> appear to be a way of specifying the repository.  Hmm.

By convention, all git commands assume they are run within the
repository. So just cd into the repo first.

Some features in gitk also assume it has been run in the repository
root. (Arguably this is a bug but apparently no one has yet gotten
around to fix it.)



  reply	other threads:[~2014-11-15  5:41 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-14 18:37 git pull fails with merge conflicts. How can this possibly happen? Alan Mackenzie
2014-11-14 19:01 ` David Caldwell
2014-11-14 21:54   ` Alan Mackenzie
2014-11-15  5:41     ` Yuri Khan [this message]
2014-11-15  8:14       ` Eli Zaretskii
2014-11-15  9:20         ` Stephen J. Turnbull
2014-11-15 10:54           ` Eli Zaretskii
2014-11-15 11:15             ` David Engster
2014-11-15 11:19             ` David Kastrup
2014-11-15 11:30               ` Eli Zaretskii
2014-11-15 14:38                 ` David Kastrup
2014-11-15 16:21                   ` Eli Zaretskii
2014-11-15 16:31               ` Stephen J. Turnbull
2014-11-15 16:55                 ` Eli Zaretskii
2014-11-15 17:05                   ` David Kastrup
2014-11-15 17:03                 ` David Kastrup
2014-11-15 18:25                   ` Stephen J. Turnbull
2014-11-15 16:25             ` git apologia [was: git pull fails with merge conflicts. ...] Stephen J. Turnbull
2014-11-15 16:51               ` Eli Zaretskii
2014-11-15 18:16                 ` Stephen J. Turnbull
2014-11-15 18:41                   ` David Kastrup
2014-11-15 19:13                   ` Git's victory and an entertaining irony Eric S. Raymond
2014-11-16  0:04                     ` Stephen J. Turnbull
2014-11-16  6:00                       ` Eric S. Raymond
2014-11-15 18:26                 ` git apologia [was: git pull fails with merge conflicts. ...] Andreas Schwab
2014-11-15 18:37                   ` Eli Zaretskii
2014-11-15 18:47                     ` David Kastrup
2014-11-16 16:06               ` git apologia Eli Zaretskii
2014-11-16 16:36                 ` Andreas Schwab
2014-11-16 18:04                   ` Eli Zaretskii
2014-11-16 18:20                     ` Andreas Schwab
2014-11-16 18:38                       ` Eli Zaretskii
2014-11-16 18:50                         ` Andreas Schwab
2014-11-16 18:58                           ` Eli Zaretskii
2014-11-16 18:55                         ` Teemu Likonen
2014-11-17  0:14                 ` Stephen J. Turnbull
2014-11-17 16:41                   ` Eli Zaretskii
2014-11-17 16:50                     ` Andreas Schwab
2014-11-17 17:47                       ` Eli Zaretskii
2014-11-17 16:57                     ` David Kastrup
2014-11-17 18:55                     ` Achim Gratz
2014-11-18  1:16                       ` Yuri Khan
2014-11-18  8:58                     ` Thien-Thi Nguyen
2014-11-18 13:53                       ` John Yates
2014-11-18 19:45                         ` Thien-Thi Nguyen
2014-11-18  9:39                     ` Andreas Schwab
2014-11-18 16:42                       ` Barry Warsaw
2014-11-17 12:38             ` git pull fails with merge conflicts. How can this possibly happen? Sergey Organov
2014-11-17 16:05               ` Eli Zaretskii
2014-11-17 16:54                 ` David Kastrup
2014-11-17 21:09                 ` Sergey Organov
2014-11-18  3:29                 ` Glenn Morris
2014-11-18 22:57                   ` Alan Mackenzie
2014-11-15 10:56           ` David Kastrup
2014-11-15 13:43             ` Stephen J. Turnbull

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAP_d_8WHBjrLGS8VZpM2JykLfJxBksx5-O6k9Gybbh7u9DJT5A@mail.gmail.com \
    --to=yuri.v.khan@gmail.com \
    --cc=acm@muc.de \
    --cc=david@porkrind.org \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).