User Tools

Site Tools


newdevs:git:install

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
newdevs:git:install [2019/06/28 17:04] – ↷ Page moved and renamed from newdevs:git to newdevs:git:install tmccannanewdevs:git:install [2023/12/13 15:03] (current) tmccanna
Line 1: Line 1:
 +**New Developers Working Group**
 ====== Git for Windows ====== ====== Git for Windows ======
  
-===== Installation and Configuration =====+//If you are running Evergreen on an Ubuntu virtual machine, git should already be installed, but this will allow you to code on a Windows machine without a virtual machine. The git commands will be the same regardless of the environment.//
  
 +===== Installation and Configuration =====
  
 ==== 1. Create an SSH Key ==== ==== 1. Create an SSH Key ====
Line 28: Line 30:
     * Open Git Bash.     * Open Git Bash.
     * At the prompt, type "git version" - Git should respond with the version that is installed     * At the prompt, type "git version" - Git should respond with the version that is installed
-    * Set up your user name and password with these commands: +    * Set up your user name and password with these commands: <code bash>git config --global user.name "FirstName LastName" 
-<code bash> +git config --global user.email "youremail@domain.com"</code> 
-git config --global user.name "FirstName LastName" +  - Add your key <code bash>ssh-add /path/to/your_private_key</code> 
-git config --global user.email "youremail@domain.com" +  - If the SSH key you use for this Git repo isn't located at: ~/.ssh/id_rsa then you will need the following configuration file in ~/.ssh/config: <code> 
-</code>+  Host git.evergreen-ils.org 
 +    IdentityFile=<LOCATION OF YOUR SSH KEY></code>
  
 **Navigating Within Git Bash** **Navigating Within Git Bash**
Line 43: Line 46:
   * Use the keyboard's "up" arrow to scroll through recent commands you've used in order to use them again.   * Use the keyboard's "up" arrow to scroll through recent commands you've used in order to use them again.
  
-==== 3. Choose a Text Editor ====+==== 3. Choose a Text Editor (optional) ====
  
 You can use any text editor you prefer to edit code. Many Evergreen developers use Vim, which runs inside the Git Bash window. You can also use outside programs such as Visual Studio Code, Notepad, Notepad++, or any other text editor that will save flat text. You can configure Git Bash to launch your text editor from a command, or you can use the text editor outside of Git Bash. Notepad++ is used in the instructions here because it will look and act the most familiar to Windows users.  You can use any text editor you prefer to edit code. Many Evergreen developers use Vim, which runs inside the Git Bash window. You can also use outside programs such as Visual Studio Code, Notepad, Notepad++, or any other text editor that will save flat text. You can configure Git Bash to launch your text editor from a command, or you can use the text editor outside of Git Bash. Notepad++ is used in the instructions here because it will look and act the most familiar to Windows users. 
  
 **Notepad++**\\ **Notepad++**\\
-The instructions below are for installing and configuring Notepad++ so that it can be launched from within Git Bash. As noted above, Notepad++ is just one of the options available.+The instructions below are for installing and configuring Notepad++ in the Windows environment so that it can be launched from within Git Bash. As noted above, Notepad++ is just one of the options available.
  
   - Download and install Notepad++ from: [[https://notepad-plus-plus.org]]   - Download and install Notepad++ from: [[https://notepad-plus-plus.org]]
Line 58: Line 61:
       * On the Advanced tab, click Environment Variables       * On the Advanced tab, click Environment Variables
     - In the System variables section, select the Path variable and click Edit.     - In the System variables section, select the Path variable and click Edit.
-    - At the end of the existing Path variable, type a semicolon and then enter the Notepad++ file path (found above).+    - At the end of the existing Path variable, type a semicolon and then enter the Notepad++ file path (found above). (Or, if paths are shown in a list, add New entry.)
   - Verify that Git Bash recognizes the new command.   - Verify that Git Bash recognizes the new command.
     - Open Git Bash.     - Open Git Bash.
Line 82: Line 85:
  
 ==== 4. Clone the Evergreen Repository ==== ==== 4. Clone the Evergreen Repository ====
 +
 +//Note that these steps assume you have read-only access to origin and write access to working.//
  
   - Create a folder to store your repositories / branches (for example, C:\Users\yourname\EGProjects).   - Create a folder to store your repositories / branches (for example, C:\Users\yourname\EGProjects).
Line 112: Line 117:
 notepad++ .git/config notepad++ .git/config
 </code> </code>
- 
- 
-===== Using Git to Create Patches ===== 
- 
- 
-==== 1. Update Your Local Repository ==== 
- 
-  - Open Git Bash 
-  - Navigate into your Evergreen repository 
-  - If the master branch isn't currently checked out, check it out: git checkout master 
-  - Before making any changes, make sure your local files are up to date with latest changes:  
-<code bash> 
-git pull origin master 
-</code> 
-==== 2. Create a New Branch to Store Your Changes ==== 
- 
-Create and checkout a branch to store your changes. The branch name should be in the format: user/your-git-user-name/launchpad#_brief_description 
- 
-<code bash> 
-git checkout -b user/username/lp123456_launchpad_bug_description 
-</code> 
- 
-==== 3. Make Your Changes ==== 
-  - Edit the file(s) you wish to change. You can either do this by launching a text editor from within Git Bash (notepad++ filename.tt2) or you can do so by opening and editing the file from Windows Explorer.  
-  - Verify that Git recognizes the files you have modified: git status 
-  - Add the file(s) you have changed to the staging area: 
-    * To stage a specific file, use: git add myfilename.txt 
-    * To stage //all// changed files, use: git add -A     
-    * If you accidentally stage a file you didn't mean to, you can unstage it: git reset HEAD myfilename.txt 
-  - Commit the staged changes: git commit 
-  - When your text editor opens to write the commit message, the first line should be the launchpad number and name, followed by the description, followed by your sign off. For example: 
- 
-  LP#1406387 Fix for Holds Placement Advanced Options 
-   
-  In the staff client, when placing a hold and clicking 
-  Advanced Hold Options, the barcode input will populate 
-  with the staff member's barcode if it was previously 
-  empty, regardless of whether the radio input for the 
-  hold was specified for a patron or the staff member. 
-   
-  Signed-off-by:  Jane Hacker <jhacker@example.org> 
- 
- 
- 
-==== 4. Push Your Changes to the Evergreen Working Repo ==== 
- 
-Upload (push) your changes: 
- 
-<code bash> 
-git push working user/username/lp123456_launchpad_bug_description 
-</code> 
- 
-==== 5. Update Launchpad ==== 
- 
-When your changes are ready for someone else to test, update the related launchpad bug: 
- 
-  - Get the URL for the patch you uploaded in the previous step by going to [[https://git.evergreen-ils.org]] and navigating to working/Evergreen.git.  
-  - Scroll down under "heads" and click on the patch you uploaded. 
-  - Copy the URL from the browser. 
-  - In the related launchpad bug, add a comment that your patch is ready for review, along with the URL you copied.  
-  - Add a "pullrequest" tag to the launchpad bug. 
- 
-===== Using Git to Test Patches ===== 
- 
-==== 1. Update Your Local Repository ==== 
- 
-  - Open Git Bash 
-  - Navigate into your Evergreen repository 
-  - If the master branch isn't currently checked out, check it out: git checkout master 
-  - Make sure your local repository is current: git pull origin master 
- 
-==== 2. Identify the Commit ID for the Patch ==== 
- 
-Identify the unique commit identifier for the patch you wish to test. This is found by clicking on a link in the related launchpad bug, or navigating to [[https://git.evergreen-ils.org]] > working/Evergreen.git > clicking on the link under "heads", then clicking on the branch. Once  there, copy the first 7+ characters from the unique commit code. 
- 
-{{ :newdevs:commit-id.jpg?direct&600 |}} 
- 
-==== 3. Create a Local Testing Branch ==== 
- 
-  - Create and checkout a local testing branch: git checkout -b lp12345 
-  - Pull changes into the testing branch using the unique commit id: git cherry-pick 7ab7281f5 
-  - Test the changes on your test server. 
- 
-**//NEED MORE INFO 
-    * If you have direct Git Bash access to your test server... Need Additional Information - how do changes get compiled? Through a git merge ?  
-    * If you do not have Git Bash access to your test server, but you have file system access to your test server through WinSCP or a similar FTP-style program, manually copy the changed files to your server for testing. 
-//** 
- 
-==== 4. Create a Sign-Off Branch ==== 
- 
-If testing is //not// successful, update the launchpad bug report with details. 
- 
-If testing //is// successful, acknowledge it by adding a sign-off branch: 
- 
-//** NEED BETTER INSTRUCTIONS HERE - I still don't quite understand how to create a branch that only contains a sign-off - does it contain all the changed files AND the sign-off? Or just the sign-off? **// 
- 
-<code bash> 
-git push working lp12345:user/my-user-name/lp12345-signoff 
-</code> 
- 
- 
-==== 5. Update Launchpad ==== 
- 
-  - In the relevant launchpad but, add the "signedoff" tag. 
-  - Also, add a link in the comments to your sign-off branch. 
- 
-===== Useful Git Bash Commands ===== 
- 
-**Git Commands** 
-  * git add myfile.txt --> stage a specific file 
-  * git add -A --> stage all modified files in the current directory and subdirectories 
-  * git add . --> (Note the period) stage all modified files in the current directory but not subdirectories 
-  * git branch --> list existing local branches 
-  * git branch mynewbranch --> create a new branch 
-  * git branch -m oldbranchname newbranchname --> change name of branch 
-  * git branch -D branchname --> delete a local branch (cannot delete a branch you currently have checked out, so switch to different branch first) 
-  * git checkout mybranch --> check out an existing branch 
-  * git checkout -b mynewbranch --> create a new branch and check it out at the same time 
-  * git checkout master --> switch to master branch 
-  * git checkout -- docname.tt2 --> resets a file you've changed back to its original state (like an undo / revert changes command) 
-  * git clone <nowiki>git://git.evergreen-ils.org/Evergreen.git</nowiki> --> clones a remote repository 
-  * git commit --> invoke the default text editor to add a commit message 
-  * git commit -m "my commit message" --> add brief commit message instead of opening the text editor to add a commit message 
-  * git commit <nowiki>--amend --> overwrite your last commit message 
-  * git commit <nowiki>--amend --signoff</nowiki> --> view and amend your sign-off branch 
-  * git commit -a --> combine the git add and git commit steps into a single step (does //not// include newly created files) 
-  * git config <nowiki>--global</nowiki> -l --> list all global configuration values 
-  * git config <nowiki>--global</nowiki> keyname "value" --> create a global value 
-  * git fetch <nowiki>--all</nowiki> --> refresh your local cache from the remote branches (does not download new branches) 
-  * git help --> access the built-in Git help documentation. 
-  * git log <nowiki>--oneline</nowiki> --> list previous commits with their unique ids 
-  * git pull --> imports all updates from your default remote repo to your default local repo (usually, this is equivalent to 'git pull origin master') 
-  * git pull origin master --> import all updates from remote origin repo to local master repo 
-  * git pull <nowiki>--rebase</nowiki> origin master --> rebases (rather than merges) new remote changes to your local repository 
-  * git push working mybranchname --> push changes to the remote working directory 
-  * git push working <nowiki>--</nowiki>delete mybranchname --> delete a remote branch 
-  * git remote -v --> display remote directories 
-  * git reset HEAD myfile.txt --> unstage a file that has already been staged 
-  * git reset <nowiki>--hard</nowiki> --> reset a current branch to its original state 
-  * git rm badfile.txt --> delete a file (if the file is being tracked, be sure to add a commit message indicating the file has been deleted) 
-  * git show <nowiki>--stat</nowiki> --> see what your commit will look like before you push it 
-  * git status --> display status of current branch 
-  * git version --> displays the installed version of Git 
- 
-**Other Commands** 
-  * cd --> move back to the home folder 
-  * cd foldername --> move from the current folder to a child folder 
-  * cd .. --> move up in the folder hierarchy one level 
-  * clear --> clears your command window giving you a fresh screen to work with 
-  * ls --> list all of the folders and files in the current folder 
-  * mkdir newfoldername --> create a new folder 
-  * notepad++ newdocname.txt --> create a new file and open it in notepad++ 
-  * notepad++ docname.txt --> edit an existing file in notepad++ 
-  * pwd --> see what folder you are currently in 
- 
- 
  
newdevs/git/install.1561755875.txt.gz · Last modified: 2022/02/10 13:34 (external edit)

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki

© 2008-2022 GPLS and others. Evergreen is open source software, freely licensed under GNU GPLv2 or later.
The Evergreen Project is a U.S. 501(c)3 non-profit organization.