Changes between Version 20 and Version 21 of Developer/Git/Users
- Timestamp:
- 11/22/18 16:11:38 (5 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Developer/Git/Users
v20 v21 13 13 The 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. 14 14 15 First we need to obtain our own local copy of the RTEMS git repository:15 First, we need to obtain our own local copy of the RTEMS git repository: 16 16 {{{ 17 17 git clone git://git.rtems.org/rtems.git rtems 18 18 }}} 19 This command will create a folder named rtems in the current directory. This folder will contain a full 20 Since all the history is available we can check out any release of RTEMS. Major RTEMS releases are available as separate branches in the repo.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 check out any release of RTEMS. Major RTEMS releases are available as separate branches in the repo. 21 21 22 22 To see all available remote branches issue the following command: … … 25 25 }}} 26 26 27 We can check out one of those remote branches (e.g. rtems-4.10 branch) using the command:27 We can check out one of those remote branches (e.g. rtems-4.10 branch) using the command: 28 28 {{{ 29 29 git checkout -b rtems410 origin/4.10 … … 46 46 Git 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. 47 47 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 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 ofupdate 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: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 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 50 First, you need to clone the repository: 51 51 {{{ 52 52 git clone git://git.rtems.org/rtems.git rtems … … 57 57 git pull 58 58 }}} 59 Create a local branch to make your changes in, in this example the change is `faster-context-switch`:59 Create a local branch to make your changes in, in this example, the change is `faster-context-switch`: 60 60 {{{ 61 61 git checkout -b faster-context-switch 62 62 }}} 63 Next make your changes to files. If you add, delete or move/rename files you need to inform Git63 Next, make your changes to files. If you add, delete or move/rename files you need to inform Git 64 64 {{{ 65 65 git add /some/new/file … … 76 76 git commit 77 77 }}} 78 Create a patch from your branch, in this case we have two commits we want to send for review:78 Create a patch from your branch, in this case, we have two commits we want to send for review: 79 79 {{{ 80 80 git format-patch -2 … … 96 96 Branches facilitate trying out new code and creating patches. 97 97 98 Previous releaseof RTEMS are available through remote branches. To check out a remote branch, first query the Git repository for the list of branches:98 The 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: 99 99 {{{ 100 100 git branch -r 101 101 }}} 102 Then check out the desired remote branch, for example:102 Then check out the desired remote branch, for example: 103 103 {{{ 104 104 git checkout -b rtems410 origin/4.10 … … 182 182 }}} 183 183 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.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. 185 185 = git reset = 186 186 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).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 the last commit). 188 188 {{{ 189 189 git reset HEAD~ … … 194 194 git reset --soft HEAD~ 195 195 }}} 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).196 Will 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). 197 197 198 198 {{{ … … 248 248 = Rebasing = 249 249 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.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. 251 251 252 252 For example … … 271 271 = Accessing a developer's repository = 272 272 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 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. 274 274 275 275 = Creating a Patch = … … 283 283 Creates 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. 284 284 285 If you are re-submitting a patch that has previously been reviewed, you should specify a version number for your patch, for example use285 If you are re-submitting a patch that has previously been reviewed, you should specify a version number for your patch, for example, use 286 286 {{{ 287 287 git format-patch -v2 ... … … 295 295 }}} 296 296 297 Please use ra real name, we do not allow pseudonyms or anonymous contributions.297 Please use a real name, we do not allow pseudonyms or anonymous contributions. 298 298 299 299 = Submitting a Patch = … … 353 353 }}} 354 354 355 This access through http is slower (way slower!) than through the git protocol thereforethe git protocol is preferred.355 This access through http is slower (way slower!) than through the git protocol, therefore, the git protocol is preferred. 356 356 357 357 = Manage Your Code = … … 408 408 = Learn more about Git = 409 409 410 Links to sitewith good Git information.410 Links to the sites with good Git information. 411 411 412 412 * http://gitready.com/ - an excellent resource from beginner to very advanced.