Changes between Version 23 and Version 24 of Developer/Git


Ignore:
Timestamp:
Feb 1, 2012, 11:52:44 PM (8 years ago)
Author:
Gedare
Comment:

/* GIT Access for contributors */

Legend:

Unmodified
Added
Removed
Modified
  • Developer/Git

    v23 v24  
    228228
    229229TODO: Some guidelines for anyone who wishes to contribute to rtems... Patches? Pull Requests?...
    230 =  GIT Push Configuration  =
    231 
    232 
    233 People with write access to the main repository should make sure that they push the right branch with the
    234  git push
    235 command.  Lets suppose we have an ''upstream'' branch intended for integration into the ''master'' branch of the main repository, then we can check the configuration with the following command
    236  git remote show origin
    237 which may print out
     230
     231The preferred workflow for making changes to RTEMS is to push patches to a committer's personal repository in public view and then merge changes from there.
     232=  SSH Access  =
     233
     234Currently all committer's should have an ssh account on the main git server, git.rtems.org.  If not then one should be requested. SSH access for git uses key logins instead of passwords. (Add some info/links to ssh key generation and management.)
     235=  Personal Repository  =
     236
     237Each committer should maintain a personal clone of the RTEMS repository to which all changes meant to be merged into the RTEMS head are sent. The following instructions show how to setup a personal repository that by default causes commits to go to your private local repository and pushes to go to your publicly visible personal repository. The RTEMS head is configured as a remote repository named 'upstream' to which you can push changes that have been approved for merging into RTEMS.
     238
     239Branches aren't automatically pushed until you tell git to do the initial push after which the branch is pushed automatically. In order to keep code private just put it on a branch and do not push the branch.
     240=  Create a personal repository  =
     241
     242Set up the server side repository. In the following substitute user with your username.
     243{{{
     244# ssh git.rtems.org
     245[user@git ~]$ ln -s /data/git/user git
     246[user@git ~]$ ls -l
     247lrwxrwxrwx 1 user rtems 16 Feb  1 11:52 git -> /data/git/user
     248[user@git ~]$ cd git
     249[user@git git]$ git clone --mirror /data/git/rtems.git
     250}}}
     251Provide a description for the repository, for example "Clone of master repository."
     252{{{
     253[user@git git]$ echo "Clone of master repository." > rtems.git/description
     254[user@git git]$ logout
     255}}}
     256Clone the repository on your local machine
     257{{{
     258# git clone ssh://user@git.rtems.org/home/user/git/rtems.git
     259# cd rtems
     260}}}
     261Add the RTEMS repository as a remote repository and get the remote tags and branches
     262{{{
     263# git remote add upstream ssh://user@git.rtems.org/data/git/rtems.git
     264# git fetch upstream
     265}}}
     266
     267After a little while you should be able to see your personal repo at http://git.rtems.org/user/rtems.git/ and you can create other repositories in your git directory that will propagate to http://git.rtems.org/user if you need.
     268=  Check your setup  =
     269
     270{{{
     271git remote show origin
     272}}}
     273Should print something similar to
     274{{{
    238275 * remote origin
    239    Fetch URL: user@git.rtems.org:git/rtems.git
    240    Push  URL: user@git.rtems.org:git/rtems.git
     276   Fetch URL: ssh://user@git.rtems.org/home/user/git/rtems.git
     277   Push  URL: ssh://user@git.rtems.org/home/user/git/rtems.git
    241278   HEAD branch: master
    242279   Remote branches:
     
    246283     master tracked
    247284   Local branch configured for 'git pull':
    248      upstream merges with remote master
     285     master merges with remote master
    249286   Local ref configured for 'git push':
    250      upstream pushes to master (up to date)
    251 
    252 Here you can see that you pull from the remote ''master'' branch into your local ''upstream'' branch and push in the other direction.  After the clone of the repository the ''master'' branch will be used as the default push branch.  You can change this with
    253  git config remote.origin.push upstream:master
     287     master pushes to master (up to date)
     288}}}
     289=  Update from remote master (head)  =
     290
     291{{{
     292# git fetch upstream
     293# git merge upstream/master
     294}}}
     295=  Push commits to personal repo master from local master  =
     296
     297{{{
     298# git push
     299}}}
     300=  Push a branch onto personal repo  =
     301
     302{{{
     303# git push origin branchname
     304}}}
     305=  Push your changes to upstream (RTEMS head)  =
     306
     307{{{
     308# git push upstream master
     309}}}
     310If someone pushed since you updated the server rejects your push until you are up to date.
     311=  GIT Push Configuration  =
     312
     313
     314People with write access to the main repository should make sure that they push the right branch with the git push command. The above setup ensures that git push will not touch the main repository, which is identified as upstream, unless you specify the upstream (by git push upstream master).
     315
     316Lets suppose we have a ''test'' branch intended for integration into the ''master'' branch of the main repository.
     317{{{
     318# git branch
     319  master
     320 *  test
     321}}}
     322There are two options for pushing with the branch. First,
     323{{{
     324# git push origin test
     325}}}
     326Will push the test branch to the personal repository. To delete the remote repository
     327{{{
     328# git push origin :test
     329}}}
     330You'll still need to delete your local branch if you are done with it.
     331
     332If you are going to work exclusively with one branch for awhile, you might want to configure git to automatically push that branch when you use git push. By default git push will use the local master branch, but you can use the 'test' branch as the source of your changes:
     333{{{
     334# git config remote.origin.push test:master
     335}}}
     336
     337Now git push will merge into your master branch on your personal repository. You can also setup a remote branch:
     338{{{
     339# git config remote.origin.push test:test
     340}}}
     341You can see what branch is configured for pushing with
     342{{{
     343# git remote show origin
     344}}}
     345And reset to the default
     346{{{
     347# git config remote.origin.push master
     348}}}
    254349=  Troubleshooting  =
    255350