[dmd-internals] shared gitconfig?

Jonathan M Davis jmdavisProg at gmx.com
Sun Jan 6 12:45:34 PST 2013


On Sunday, January 06, 2013 14:39:11 Andrei Alexandrescu wrote:
> Hello,
> 
> 
> I wonder how we can define a few aliases of project-wide usefulness to
> git. For example, I tried today to get the latest and greatest phobos
> into my repo, and got a bunch of conflicts. I searched a while on the
> net to figure what the command for "just get the latest remote into my
> local copy", which is entirely possible but not obvious and not easy to
> find. I got it from here: http://goo.gl/pWvVB and the invocation is:
> 
> git pull --rebase -s recursive -X ours
> 
> which does work like a charm. So I wanted to define a macro called
> "pull-force" like this:
> 
> # Inside ~/.gitconfig
> [alias]
>      pull-force = pull --rebase -s recursive -X ours
>      ...
> 
> This, too, works great.
> 
> What I'd want to do next is define the alias such that other
> participants to the dlang project may use it. With time we'd collect a
> good set of macros that help our process.
> 
> What is the best way to share a few git config items among all
> participants to dmd, druntime, phobos etc?

Maybe some macros would be useful, but I'm kind of inclined to think that 
people should just learn git, especially since many people will need it beyond 
our projects and learning an alias that doesn't exist elsewhere will just 
hamstring you. I think that it would be a better idea to have a page in the 
wiki listing useful commands so that people can learn them properly rather 
than relying on an alias that isn't standard git and which won't exist on any 
other projects.

But with regards to this particular command, I'd argue that you're doing 
something wrong if you need to force a rebase with a pull. How on earth did 
you end up in a situation where you needed to force a rebase like this on 
master or any branch that's in the main repo? Changes should be being done on 
separate branches, not on master. So, master doesn't need to be rebased. And 
generally, branches are your local branches, managed by you and which 
generally are relatively short-lived, so you won't need to do what you're 
describing here for them. If you're making changes on other branches in the 
main repository, I'd expect them to be treated the same as master. You make 
changes on your own, separate branch, push that to your repo on github for a 
pull request and get that merged into the branch in the main repo. So, in no 
case do you end up with any branch on your box being out of sync with the main 
repo. The rebasing that should be needed is when you have to rebase one of 
your local branches with master, because other changes were merged into master 
via pull requests, and the changes in your branch haven't been merged in on 
github yet.

The only time that you'd need to make a change directly on master or any 
branch which is in the main repository is when you actually push upstream from 
your local box instead of going through github, which we're not generally 
supposed to do. I have _never_ needed the command that you just listed.

Maybe, you did something normal that I can't think of, but it seems to me that 
the problem here is your workflow, not the need for a macro.

- Jonathan M Davis


More information about the dmd-internals mailing list