Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

A slightly open question regarding best practices, I can find lots of functional guides for git but not much info about standard ordering of operations etc:

Whats the standard/nice way of working with remote repositories, specifically for making a change and taking it all the way back to the remote master. Can someone provide a step-by-step list of procedures they normally follow when doing this. i.e. something like:

  1. clone repo
  2. create new local branch of head
  3. make changes locally and commit to local branch
  4. ...
share|improve this question
    
Somewhat subjective, but looks okay to me as the question calls for specific, well-defined procedures and not mere opinions. See Good Subjective, Bad Subjective. –  DragonLord Nov 28 '12 at 16:41

1 Answer 1

Here is how I do it. I usually work on the remote repository by myself so comments are welcome, especially from people who use a similar workflow collaboratively.

On local computer: clone the remote repository.

git clone ssh://user@master:path/my_rep
cd my_rep

The cloned repository creates automatically an 'origin' link to the master. Before working it is a good idea to pull the latest changes and create a local branch:

git pull origin --rebase
git checkout -b local_mybranch
(... work ...)
git commit -a
(... work ...)
git commit -a

Before pushing your changes to the master you can always do a pull of the master change and rebase your work branch on it. A trick I often use is to make a rebase with the -i option. That way you can paste your commit together in one single giant commit.

git checkout master
git pull --rebase
git checkout local_mychanges
git rebase -i master

Then push your changes on remote: git push origin local_mybranch:mybranch_on_remote

On the remote repository. You (or someone else) can merge the changes in the master branch.

git checkout master    
git merge mybranch_on_remote
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.