Skip to content

Instantly share code, notes, and snippets.

@phillmv
Created December 9, 2009 04:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save phillmv/252253 to your computer and use it in GitHub Desktop.
Save phillmv/252253 to your computer and use it in GitHub Desktop.
git strat
Git Strategy (Version 2)
16:20 < hiffy> I have a question on, I guess, architecture
16:20 < hiffy> so I have this git repo, works swell
16:21 < hiffy> and I have a prod and a test env. I’d like keep a separate
branch for my test environment and then “promote” commits to the
main branch
16:21 < hiffy> is this… doable or advisable?
16:24 < wereHamster> hiffy: typically, you’d make commits to the test branch
and if all tests and QA pass, you’d merge the test branch
into master
16:24 < hiffy> that sounds like what I had in mind.
16:25 < hiffy> wereHamster: so I would be, git checkout test; git add foo bar
baz; git commit -m “test test test!”; git checkout main; git
pull test?
16:30 < yann> hiffy: you’re likely to make better use of explicit commit
messages on test branch if you’re going to use git-pull. Anyway,
you should consider using rebase instead of pull, to reduce the
number of useless merges
16:31 < hiffy> yann: Right. I have a fair grasp of all the basic commands, I’m
still wrapping my head around the more “complicated” operations
:)
16:31 < yann> ok :)
16:32 < hiffy> yann: but is that workflow is correct if I sub pull for rebase?
16:32 < hiffy> yann: also, can you selectively merge in commits?
16:32 * hiffy reads up on the docs
16:33 < jackdempsey> hiffy: as long as the branch test has all the commits
master has, then you can just do git merge test on master
16:33 < jackdempsey> if you go off onto test and do stuff
16:33 < jackdempsey> then do stuff on master
16:33 < jackdempsey> you’ll want to git rebase master (while on test)
16:33 < yann> what do you mean by selectively ? I suspect you want to
cherry-pick commits
16:33 < jackdempsey> then git merge test (while on master)
16:34 < hiffy> yann: Yeah I think cherry-pick is the term. I.e. I push feature
foo and bar into test and want to promote bar to prod before I
promote foo
16:34 < yann> yes, that’s it
16:35 * hiffy ponders
16:36 < hiffy> I’m going to be doing funny things to my capistrano script.
16:37 < hiffy> ok, ok, so comprehension recap (thanks jackdempsey yann !), hack
away on test, commit at will. When I’m satisfied with changes on
test, I can merge or cherrypick commits to master; if I commit
something to master that I want on test I might as well rebase
16:37 < yann> sounds correct
Also:
< Mikachu> hiffy: a) git push origin localbranch:remotebranch b) git checkout localbranch; git pull origin remotebranch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment