github
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| github [2022/02/01 19:07] – pwolinsk | github [2025/10/15 19:51] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ===== Github | + | ===== Git - version control |
| + | |||
| + | ' | ||
| + | |||
| + | < | ||
| + | git init - specify a directory for version control with git | ||
| + | git add - add a file to a list of file for version control | ||
| + | git commit | ||
| + | git branch | ||
| + | git checkout - switch to the alternate branch (version of files) | ||
| + | git merge - combine two branches into one | ||
| + | git log - show a history of commits (snapshots) | ||
| + | git ls-files - show an index of files in the version control system | ||
| + | </ | ||
| + | |||
| + | |||
| + | The following example shows step by step how to use git to keep track of changes made to your personal project on Pinnacle. | ||
| + | |||
| + | **1.** create a new project directory and initialize its management with git. ('' | ||
| + | |||
| + | < | ||
| + | pinnacle-l1: | ||
| + | pinnacle-l1: | ||
| + | pinnacle-l1: | ||
| + | Initialized empty Git repository in / | ||
| + | pinnacle-l1: | ||
| + | </ | ||
| + | |||
| + | **2.** create files in the project directory | ||
| + | |||
| + | < | ||
| + | pinnacle-l1: | ||
| + | pinnacle-l1: | ||
| + | pinnacle-l1: | ||
| + | Some text in file1 | ||
| + | pinnacle-l1: | ||
| + | More text in file 2. | ||
| + | pinnacle-l1: | ||
| + | </ | ||
| + | |||
| + | **3.** add new files to the index (list) of files managed with git. ('' | ||
| + | |||
| + | < | ||
| + | pinnacle-l1: | ||
| + | # On branch master | ||
| + | # | ||
| + | # Initial commit | ||
| + | # | ||
| + | # Untracked files: | ||
| + | # (use "git add < | ||
| + | # | ||
| + | # file1 | ||
| + | # file2 | ||
| + | nothing added to commit but untracked files present (use "git add" to track) | ||
| + | pinnacle-l1: | ||
| + | pinnacle-l1: | ||
| + | pinnacle-l1: | ||
| + | # On branch master | ||
| + | # | ||
| + | # Initial commit | ||
| + | # | ||
| + | # Changes to be committed: | ||
| + | # (use "git rm --cached < | ||
| + | # | ||
| + | # new file: | ||
| + | # new file: | ||
| + | # | ||
| + | pinnacle-l1: | ||
| + | </ | ||
| + | |||
| + | **4.** create a snapshot of the current state of all files tracked by git in the project directory. ('' | ||
| + | < | ||
| + | pinnacle-l1: | ||
| + | [master (root-commit) d4a8ab1] added initial text to file 1 | ||
| + | 1 file changed, 1 insertion(+) | ||
| + | | ||
| + | pinnacle-l1: | ||
| + | [master cd7ebfa] added initial text to file 2 | ||
| + | 1 file changed, 1 insertion(+) | ||
| + | | ||
| + | pinnacle-l1: | ||
| + | </ | ||
| + | |||
| + | **5.** modify file1 and file2 and create another snapshot of the current version of files. | ||
| + | < | ||
| + | pinnacle-l1: | ||
| + | pinnacle-l1: | ||
| + | pinnacle-l1: | ||
| + | [master db1a5f1] added extra lines to file1 and file2 | ||
| + | 2 files changed, 2 insertions(+) | ||
| + | pinnacle-l1: | ||
| + | </ | ||
| + | |||
| + | **6.** review a history of commits. ('' | ||
| + | < | ||
| + | pinnacle-l1: | ||
| + | commit db1a5f1746b635bdbb73ebcc49dc3cf56a8ba2cf | ||
| + | Author: pwolinsk < | ||
| + | Date: Tue Mar 1 12:47:48 2022 -0600 | ||
| + | |||
| + | added extra lines to file1 and file2 | ||
| + | |||
| + | commit cd7ebfa2e6e67cf4e918be7bbba5c0e79af76036 | ||
| + | Author: pwolinsk < | ||
| + | Date: Tue Mar 1 12:45:02 2022 -0600 | ||
| + | |||
| + | added initial text to file 2 | ||
| + | |||
| + | commit d4a8ab16fc53ba39b8bdf8f3b40db21681901f2f | ||
| + | Author: pwolinsk < | ||
| + | Date: Tue Mar 1 12:44:55 2022 -0600 | ||
| + | |||
| + | added initial text to file 1 | ||
| + | pinnacle-l1: | ||
| + | </ | ||
| + | |||
| + | **7.** Revert to a previous version of the files. | ||
| + | < | ||
| + | pinnacle-l1: | ||
| + | Some text in file1 | ||
| + | pinnacle-l1: | ||
| + | More text in file 2. | ||
| + | line 2 again | ||
| + | pinnacle-l1: | ||
| + | Note: checking out ' | ||
| + | |||
| + | You are in ' | ||
| + | changes and commit them, and you can discard any commits you make in this | ||
| + | state without impacting any branches by performing another checkout. | ||
| + | |||
| + | If you want to create a new branch to retain commits you create, you may | ||
| + | do so (now or later) by using -b with the checkout command again. Example: | ||
| + | |||
| + | git checkout -b new_branch_name | ||
| + | |||
| + | HEAD is now at d4a8ab1... added initial text to file 1 | ||
| + | pinnacle-l1: | ||
| + | Some text in file1 | ||
| + | pinnacle-l1: | ||
| + | pinnacle-l1: | ||
| + | </ | ||
| + | |||
| + | **8.** Go back to the latest version of files. ('' | ||
| + | |||
| + | < | ||
| + | pinnacle-l1: | ||
| + | commit db1a5f1746b635bdbb73ebcc49dc3cf56a8ba2cf | ||
| + | Author: pwolinsk < | ||
| + | Date: Tue Mar 1 12:47:48 2022 -0600 | ||
| + | |||
| + | added extra lines to file1 and file2 | ||
| + | |||
| + | commit cd7ebfa2e6e67cf4e918be7bbba5c0e79af76036 | ||
| + | Author: pwolinsk < | ||
| + | Date: Tue Mar 1 12:45:02 2022 -0600 | ||
| + | |||
| + | added initial text to file 2 | ||
| + | |||
| + | commit d4a8ab16fc53ba39b8bdf8f3b40db21681901f2f | ||
| + | Author: pwolinsk < | ||
| + | Date: Tue Mar 1 12:44:55 2022 -0600 | ||
| + | |||
| + | added initial text to file 1 | ||
| + | pinnacle-l1: | ||
| + | pinnacle-l1: | ||
| + | Previous HEAD position was d4a8ab1... added initial text to file 1 | ||
| + | HEAD is now at db1a5f1... added extra lines to file1 and file2 | ||
| + | pinnacle-l1: | ||
| + | Some text in file1 | ||
| + | line 2 | ||
| + | pinnacle-l1: | ||
| + | More text in file 2. | ||
| + | line 2 again | ||
| + | pinnacle-l1: | ||
| + | </ | ||
| + | |||
| + | ===== GitHub | ||
| Github is a popular platform for collaboration and data sharing. | Github is a popular platform for collaboration and data sharing. | ||
| Line 19: | Line 195: | ||
| < | < | ||
| - | pinnacle-l7: | + | pinnacle-l7: |
| | | ||
| Line 30: | Line 206: | ||
| Do you have an existing github account? [y/N] y | Do you have an existing github account? [y/N] y | ||
| - | Please enter you github username: | + | Please enter you github username: |
| - | Please enter your email: | + | Please enter your email: |
| - | Github username: | + | Github username: |
| - | email: | + | email: |
| Is this correct? [y/N] y | Is this correct? [y/N] y | ||
| Using a browser, please copy and paste your AHPCC SSH public key below into | Using a browser, please copy and paste your AHPCC SSH public key below into | ||
| Line 41: | Line 217: | ||
| - | ssh-rsa | + | ssh-rsa |
| Did you add your public SSH key above to your github.com account? [y/N] y | Did you add your public SSH key above to your github.com account? [y/N] y | ||
| - | Your github configuration (in /home/pwolinsk/ | + | Your github configuration (in /home/user1/ |
| [user] | [user] | ||
| - | name = pwolinsk | + | name = user1 |
| email = gh_email | email = gh_email | ||
| [color] | [color] | ||
| Line 65: | Line 241: | ||
| - gh config set -h github.com git_protocol ssh | - gh config set -h github.com git_protocol ssh | ||
| ✓ Configured git protocol | ✓ Configured git protocol | ||
| - | ✓ Logged in as pwolinsk | + | ✓ Logged in as user1 |
| Testing github integration with your AHPCC account... | Testing github integration with your AHPCC account... | ||
| github.com | github.com | ||
| - | ✓ Logged in to github.com as pwolinsk | + | ✓ Logged in to github.com as user1 (/home/user1/ |
| ✓ Git operations for github.com configured to use ssh protocol. | ✓ Git operations for github.com configured to use ssh protocol. | ||
| ✓ Token: ******************* | ✓ Token: ******************* | ||
| | | ||
| - | Invitation to join DART-ARP github organization has been sent to pwolinsk@uark.edu | + | Invitation to join DART-ARP github organization has been sent to user1@uark.edu |
| Please follow the link in the email to join. | Please follow the link in the email to join. | ||
| - | pinnacle-l7: | + | pinnacle-l7: |
| </ | </ | ||
github.1643742473.txt.gz · Last modified: (external edit)
