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
Next revision Both sides next revision
git [2020/04/12 20:43]
jfduval [Understanding merging]
git [2020/11/01 19:32]
alayne [NOTE: LOG IN ISSUES]
Line 1: Line 1:
 ====== Using Git at Dephy ====== ====== Using Git at Dephy ======
 +===== NOTE: LOG IN ISSUES =====
 +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 |}}
  
 ===== Getting started ===== ===== Getting started =====
Line 113: Line 116:
 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 154:
  
 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 160: Line 163:
   * Look for the ''>>>''​ symbols indicating a conflict. ​   * Look for the ''>>>''​ symbols indicating a conflict. ​
   * Fix the conflict, remove the indicators.   * Fix the conflict, remove the indicators.
-  * ''​git add source.c''​ +  * Call ''​git add source.c'' ​to let git know that you have fixed the conflict 
-  * ''​git commit -am "Fixed merged conflict, correct value is 200."+  * ''​git commit -am "Fixed merged conflict, correct value is 200."''​
  
 +The easiest way to prevent a merge conflict is to push and and pull frequently. Merging a few hours of work is usually far easier than merging days worth of work.
  
 ==== Everything else ==== ==== Everything else ====
Line 184: Line 188:
 ==== 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 190: Line 194:
 ===== 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) ====
git.txt · Last modified: 2021/02/19 23:59 by casmat