| | 91 | |
| | 92 | === Creating a new branch from the current ref === |
| | 93 | |
| | 94 | Using git checkout you can start a new branch: |
| | 95 | |
| | 96 | {{{ |
| | 97 | git checkout -b testing |
| | 98 | }}} |
| | 99 | |
| | 100 | Lets change the test file in this branch so we can identify it in the future: |
| | 101 | |
| | 102 | {{{ |
| | 103 | echo "Testing Branch" > testfile |
| | 104 | git add testfile |
| | 105 | git commit -m "Change the test file for the Testing Branch" |
| | 106 | }}} |
| | 107 | |
| | 108 | === Switching between branches === |
| | 109 | |
| | 110 | Using git checkout you can switch between branches. Switch back to master and check the testfile: |
| | 111 | |
| | 112 | {{{ |
| | 113 | git checkout master |
| | 114 | cat testfile |
| | 115 | }}} |
| | 116 | |
| | 117 | Switch back to testing and check the test file |
| | 118 | |
| | 119 | {{{ |
| | 120 | git checkout testing |
| | 121 | cat testfile |
| | 122 | }}} |