Changes between Version 20 and Version 21 of Developer/Git/Users


Ignore:
Timestamp:
11/22/18 16:11:38 (5 years ago)
Author:
Abhimanyu Raghuvanshi
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Developer/Git/Users

    v20 v21  
    1313The following examples demonstrate how to use the RTEMS' git repos. These examples are provided for the main rtems module, but they are also valid for the other modules.
    1414
    15 First we need to obtain our own local copy of the RTEMS git repository:
     15First, we need to obtain our own local copy of the RTEMS git repository:
    1616{{{
    1717 git clone git://git.rtems.org/rtems.git rtems
    1818}}}
    19 This command will create a folder named rtems in the current directory. This folder will contain a full featured rtems' git repository and the current HEAD revision checked out.
    20 Since all the history is available we can checkout any release of RTEMS. Major RTEMS releases are available as separate branches in the repo.
     19This command will create a folder named rtems in the current directory. This folder will contain a full-featured rtems' git repository and the current HEAD revision checked out.
     20Since all the history is available we can check out any release of RTEMS. Major RTEMS releases are available as separate branches in the repo.
    2121
    2222To see all available remote branches issue the following command:
     
    2525}}}
    2626
    27 We can checkout one of those remote branches (e.g. rtems-4.10 branch) using the command:
     27We can check out one of those remote branches (e.g. rtems-4.10 branch) using the command:
    2828{{{
    2929 git checkout -b rtems410 origin/4.10
     
    4646Git allows you to make changes in the RTEMS source tree and track those changes locally. We recommend you make all your changes in local branches. If you are working on a few different changes or a progression of changes it is best to use a local branch for each change.
    4747
    48 A branch for each change lets your repo's master branch track the upstream RTEMS's master branch without interacting with any of the changes you are working on. A completed change is emailed to the developers list for review and this can take time. While this is happening the upstream's master branch may be updated and you may need to rebase your work and test again if you are required to change of update your patch. A local branch isolates a specific change from others and helps you manage the process.
    49 
    50 First you need to clone the repository:
     48A branch for each change lets your repo's master branch track the upstream RTEMS's master branch without interacting with any of the changes you are working on. A completed change is emailed to the developer's list for review and this can take time. While this is happening the upstream's master branch may be updated and you may need to rebase your work and test again if you are required to change or update your patch. A local branch isolates a specific change from others and helps you manage the process.
     49
     50First, you need to clone the repository:
    5151{{{
    5252 git clone git://git.rtems.org/rtems.git rtems
     
    5757 git pull
    5858}}}
    59 Create a local branch to make your changes in, in this example the change is `faster-context-switch`:
     59Create a local branch to make your changes in, in this example, the change is `faster-context-switch`:
    6060{{{
    6161 git checkout -b faster-context-switch
    6262}}}
    63 Next make your changes to files. If you add, delete or move/rename files you need to inform Git
     63Next, make your changes to files. If you add, delete or move/rename files you need to inform Git
    6464{{{
    6565 git add /some/new/file
     
    7676 git commit
    7777}}}
    78 Create a patch from your branch, in this case we have two commits we want to send for review:
     78Create a patch from your branch, in this case, we have two commits we want to send for review:
    7979{{{
    8080 git format-patch -2
     
    9696Branches facilitate trying out new code and creating patches.
    9797
    98 Previous release of RTEMS are available through remote branches. To check out a remote branch, first query the Git repository for the list of branches:
     98The previous releases of RTEMS are available through remote branches. To check out a remote branch, first query the Git repository for the list of branches:
    9999{{{
    100100 git branch -r
    101101}}}
    102 Then checkout the desired remote branch, for example:
     102Then check out the desired remote branch, for example:
    103103{{{
    104104 git checkout -b rtems410 origin/4.10
     
    182182}}}
    183183
    184 To remove commits there are two useful options, reset and revert. git reset should only be used on local branches that no one else is accessing remotely. git revert is cleaner, and is the right way to revert changes that have already been pushed/pulled remotely.
     184To remove commits there are two useful options, reset and revert. git reset should only be used on local branches that no one else is accessing remotely. git revert is cleaner and is the right way to revert changes that have already been pushed/pulled remotely.
    185185= git reset =
    186186
    187 git reset is a powerful and tricky command that should only be used on local (un-pushed) branches): A good description of what it enables to do can be found [http://progit.org/2011/07/11/reset.html here]. The following are a few useful examples. Note that adding a ~ after HEAD refers to the most recent commit, and you can add a number after the ~ to refer to commits even further back; HEAD by itself refers to the current working directory (changes since last commit).
     187git reset is a powerful and tricky command that should only be used on local (un-pushed) branches): A good description of what it enables to do can be found [http://progit.org/2011/07/11/reset.html here]. The following are a few useful examples. Note that adding a ~ after HEAD refers to the most recent commit, and you can add a number after the ~ to refer to commits even further back; HEAD by itself refers to the current working directory (changes since the last commit).
    188188{{{
    189189git reset HEAD~
     
    194194git reset --soft HEAD~
    195195}}}
    196 Will just undo the last commit. The changes from last commit will still be staged (just as if you finished git adding them).  This can be used to amend the last commit (e.g. I forgot to add a file to the last commit).
     196Will just undo the last commit. The changes from the last commit will still be staged (just as if you finished git adding them).  This can be used to amend the last commit (e.g. I forgot to add a file to the last commit).
    197197
    198198{{{
     
    248248= Rebasing =
    249249
    250 An alternative to the merge command is rebase, which replays the changes (commits) on one branch onto another. git rebase finds the common ancestor of the two branches, stores each commit of the branch you’re on to temporary files, and applies each commit in order.
     250An alternative to the merge command is rebase, which replays the changes (commits) on one branch onto another. git rebase finds the common ancestor of the two branches, stores each commit of the branch you’re on to temporary files and applies each commit in order.
    251251
    252252For example
     
    271271= Accessing a developer's repository =
    272272
    273 RTEMS developers with Git commit access have personal repositories on http://git.rtems.org/ that can be [wiki:Git_Committers#Pull_a_Developer's_Repo pulled] to view cutting edge development work shared there.
     273RTEMS developers with Git commit access have personal repositories on http://git.rtems.org/ that can be [wiki:Git_Committers#Pull_a_Developer's_Repo pulled] to view cutting-edge development work shared there.
    274274
    275275= Creating a Patch =
     
    283283Creates a separate patch for each commit that has been made between the master branch and the current branch and writes them in the current directory. Use the -o flag to redirect the files to a different directory.
    284284
    285 If you are re-submitting a patch that has previously been reviewed, you should specify a version number for your patch, for example use
     285If you are re-submitting a patch that has previously been reviewed, you should specify a version number for your patch, for example, use
    286286{{{
    287287 git format-patch -v2 ...
     
    295295}}}
    296296
    297 Please user a real name, we do not allow pseudonyms or anonymous contributions.
     297Please use a real name, we do not allow pseudonyms or anonymous contributions.
    298298
    299299= Submitting a Patch =
     
    353353}}}
    354354
    355 This access through http is slower (way slower!) than through the git protocol therefore the git protocol is preferred. 
     355This access through http is slower (way slower!) than through the git protocol, therefore, the git protocol is preferred. 
    356356
    357357=  Manage Your Code  =
     
    408408=  Learn more about Git  =
    409409
    410 Links to site with good Git information.
     410Links to the sites with good Git information.
    411411
    412412 * http://gitready.com/ - an excellent resource from beginner to very advanced.