FlexSEA Wiki

A WEARABLE ROBOTICS TOOLKIT

User Tools

Site Tools


git

Differences

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

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
git [2020/04/12 20:45]
jfduval [Understanding merging]
git [2020/11/02 13:21] (current)
jfduval
Line 15: Line 15:
     * If you prefer a graphical user interface you can request a GitKraken license.     * If you prefer a graphical user interface you can request a GitKraken license.
     * To compare branches: [[https://​winmerge.org/​|WinMerge]]     * To compare branches: [[https://​winmerge.org/​|WinMerge]]
 +    * **<color #​ed1c24>​Important</​color>:​** review the [[#​two-factor_authentication|Two-Factor authentication]] section if you have log-in issues.
   * [[#​Essential commands|Essential commands]]   * [[#​Essential commands|Essential commands]]
   * [[#​Additional commands & tricks]]   * [[#​Additional commands & tricks]]
Line 113: Line 114:
 Tip: depending on the tree structure between the branch you may have to call ''​git merge origin/​theirBranch''​ for it to be recognized. Tip: depending on the tree structure between the branch you may have to call ''​git merge origin/​theirBranch''​ for it to be recognized.
  
-If you are playing in Easy mode, the two branches will beatly ​merge and you won't have anything to do. In Real Life mode conflicts are frequent. git will list the files that it wasn't able to merge automatically. You need to open them one after the other and look for the ''<<<<<<''​ and ''>>>>>>>''​ symbols, and manually fix what's wrong.+If you are playing in Easy mode, the two branches will easily ​merge and you won't have anything to do. In Real Life mode conflicts are frequent. git will list the files that it wasn't able to merge automatically. You need to open them one after the other and look for the ''<<<<<<''​ and ''>>>>>>>''​ symbols, and manually fix what's wrong.
 Typical reasons why it won't automatically merge: Typical reasons why it won't automatically merge:
   * Tabs (good) vs spaces (bad)   * Tabs (good) vs spaces (bad)
Line 151: Line 152:
  
 Later that day you change myVariable to be 200. You do not commit or push this code, it only exists on your local machine. Later that day you change myVariable to be 200. You do not commit or push this code, it only exists on your local machine.
-Your colleague B also things ​that myVariable shouldn'​t be 100. He changes it to be 250, commits his code and pushed ​it.+Your colleague B also thinks ​that myVariable shouldn'​t be 100. He changes it to 250, commits his code and pushes ​it.
 Tuesday you remember that you forgot to commit this important change. You do: Tuesday you remember that you forgot to commit this important change. You do:
   * ''​git commit -am "Bug fix, variable had wrong value"''​   * ''​git commit -am "Bug fix, variable had wrong value"''​
Line 185: Line 186:
 ==== Specific line of code ==== ==== Specific line of code ====
  
-We often need to refer to a vary specific ​l;ine or section of the code. On github.com, ​of you click on the line lumber if will highlight that line, and modify the URL for you. Here's an example where I'm pointing at main(), in main.cpp of the DSEP-64_PyVersion branch of the Actuator-Package repository: https://​github.com/​DephyInc/​Actuator-Package/​blob/​DSEP-64_PyVersion/​C/​main.cpp#​L46+We often need to refer to a vary specific ​line or section of the code. On github.com, ​if you click on the line number, it will highlight that line, and modify the URL for you. Here's an example where I'm pointing at main(), in main.cpp of the DSEP-64_PyVersion branch of the Actuator-Package repository: https://​github.com/​DephyInc/​Actuator-Package/​blob/​DSEP-64_PyVersion/​C/​main.cpp#​L46
  
 {{ :​gitline.png?​600 |}} {{ :​gitline.png?​600 |}}
Line 191: Line 192:
 ===== Real life examples - Dephy specific ===== ===== Real life examples - Dephy specific =====
  
-Some/most of that is already covered in [[sourcecode|Source Code]], but I'm including here for your convenience.+Some/most of this is already covered in [[sourcecode|Source Code]], but I'm including here for your convenience.
  
 ==== Cloning a repository and its submodule(s) ==== ==== Cloning a repository and its submodule(s) ====
Line 268: Line 269:
   - Set your github.com password   - Set your github.com password
   - ''​git config --global core.autocrlf input''​ so git use LF as end of line (that makes Bash scripts work equally well on Win and Unix)   - ''​git config --global core.autocrlf input''​ so git use LF as end of line (that makes Bash scripts work equally well on Win and Unix)
 +
 +===== Two-Factor Authentication =====
 +
 +Since we have started using 2 factor authentication,​ you may have to use personal access tokens when attempting to access the github repositories from the command line and certain applications. Simply substitute your password for the token. ​ To get a token, go to github.com. Then got to settings->​Developer Tools-> Personal Access Tokens.  ​
 +{{ :​howtocreategithubtoken.png?​600 |}}
git.1586724329.txt.gz ยท Last modified: 2020/04/12 20:45 by jfduval