Quantcast
Channel: ScrollingText - Git
Viewing all articles
Browse latest Browse all 4

Git Prepush

$
0
0

I'm not sure how everyone else uses git, but at work we use it in a more centralized manner, just like the subversion I migrated us from some time ago. That means that for our changes we create a branch off of the master branch, known as a "feature branch", make our changes, test said changes, do a quick peer review, and finally merge back into master; rinse; and repeat.

Since there are changes constantly going into the master branch, that means we have to do what I call the git prepush shuffle, which is:
1) checkout master
2) update (pull) master branch
3) checkout feature branch
4) update (rebase) feature branch
5) fix conflicts (if any)

Now the feature branch is ready to push for the review process then be merged into master.

Why am I telling you all of this? Well, I hate having to type all of that stuff out each and every time. One day I wondered if there was a way I could improve this. I knew I could do aliases, so now it became a question of if I could do more than one command within an alias. A little internet searching lead me to this StackOverflow answer, that showed that it was possible.

This brought me to the next hurdle; I knew I needed to switch to the master branch. But then how would I get back to the feature branch? A little more rabbit hole falling got me to this StackOverflow answer, which states that you can go back to the previous branch with the "@{-1}" reference.

The one note I would also like to add before I show you what I did is that I assume that:

  1. [branch]
  2. autosetuprebase = always

is set. WHich I've found really helpful when I'm working on a more centralized manner which multiple committers.

My ultimate "creation" is this:

  1. [alias]
  2. prepush = !git checkout master && git pull && git checkout @{-1} && git rebase master

So if anyone out there does the same dance that I do, feel free to use this alias and save yourself some time and typing.


Viewing all articles
Browse latest Browse all 4

Latest Images

Vimeo 10.7.0 by Vimeo.com, Inc.

Vimeo 10.7.0 by Vimeo.com, Inc.

HANGAD

HANGAD

MAKAKAALAM

MAKAKAALAM

Doodle Jump 3.11.30 by Lima Sky LLC

Doodle Jump 3.11.30 by Lima Sky LLC

Doodle Jump 3.11.30 by Lima Sky LLC

Doodle Jump 3.11.30 by Lima Sky LLC

Vimeo 10.6.2 by Vimeo.com, Inc.

Vimeo 10.6.2 by Vimeo.com, Inc.

Vimeo 10.6.1 by Vimeo.com, Inc.

Vimeo 10.6.1 by Vimeo.com, Inc.

Vimeo 10.6.0 by Vimeo.com, Inc.

Vimeo 10.6.0 by Vimeo.com, Inc.

Trending Articles


La nang skuin hi thuit ka lyer MP


Mandalas de flores para colorear


Toro para colorear


Aristotle Quotes ; Love Quotes


Tagalog Sweet Love Quotes : Tagalog Love Quotes


Love Quotes Tagalog


RE: Mutton Pies (mely)


Ang Nobela sa “From Darna to ZsaZsa Zaturnnah: Desire and Fantasy, Essays on...


El Vibora (1971) by Francisco V. Coching and Federico C. Javinal


Version 0.8.5 – Peb txhawb tus Lao heev





Latest Images

Vimeo 10.7.0 by Vimeo.com, Inc.

Vimeo 10.7.0 by Vimeo.com, Inc.

HANGAD

HANGAD

MAKAKAALAM

MAKAKAALAM

Doodle Jump 3.11.30 by Lima Sky LLC

Doodle Jump 3.11.30 by Lima Sky LLC

Doodle Jump 3.11.30 by Lima Sky LLC

Doodle Jump 3.11.30 by Lima Sky LLC

Vimeo 10.6.1 by Vimeo.com, Inc.

Vimeo 10.6.1 by Vimeo.com, Inc.

Vimeo 10.6.0 by Vimeo.com, Inc.

Vimeo 10.6.0 by Vimeo.com, Inc.