Washington Community Group

cancel
Showing results for 
Search instead for 
Did you mean: 

git, LabVIEW and team development [3/13/2019 meeting]

Hey all thanks for coming last night.

 

I copied a internal wiki article that I have been slowing building up on using git with LabVIEW.  It is rough but has some good stuff in it. 

 

Any info that people have please share.

 

See you all soon. 

 

Gitting going

 

Assuming Windows here just because most of us in the HW group use Windows. But most of this should apply on Mac/Linux as well.

  1. Download GIT
  2. Install GIT, make sure to include it in your %PATH%
  3. Make sure that you have a Bitbucket account setup. This can be setup using you Fresh/Google login credentials. If you have any questions talk to Steve Heulet, he is our Bitbucket/Atlassian admin.
  4. Associate your GIT environment with Bitbucket. Much of this step will use the information found Atlassian's Set Up An SSH Key documentation in section Set up SSH for Git on Windows under step 3.

Open GIT Bash (or GIT CMD, probably). In Windows 8.1 and newer, press Windows key and type in "GIT Bash").

Create an SSH Key, following the example below.

Note the location of the keys; if you used the default key location (blank) and default passphrase (blank) as above, these will live in "/c/Users/Fresh/.ssh/id_rsa". You'll need to open the .pub public key in this folder later.

Add the key to the ssh-agent using eval and ssh-add as shown below.

Untitled.png

Note the location of the keys; if you used the default key location (blank) and default passphrase (blank) as above, these will live in "/c/Users/Fresh/.ssh/id_rsa". You'll need to open the .pub public key in this folder later.

Add the key to the ssh-agent using eval and ssh-add as shown below.

Untitled.png

Add the public key to Bitbucket settings. If you followed the example above, this will live in "/c/Users/Fresh/.ssh/id_rsa.pub". Open that file in Notepad and copy all of the contents. Open Bitbucket in web browser. Go to your account Settings and SSH Keys (bottom left icon >> Settings >> SSH keys). Click Add key. Label your key whatever and paste the public key you copied above in the *'d box and click "Add key" in the dialog box.

 

Untitled.png

Confirm you've done things right using ssh -T <username>@bitbucket.org as shown.

Untitled.png

Now finally clone a private Fresh Consulting repo! Be sure to set the directory to your desired home for your clone. Example shown below, cloning this wiki.

Untitled.png

GITing work done- Your git cheat sheet 

Workflows

There are two major schools of how people use git. Centralized workflow and branching workflow. For a more detailed explanation see this article.

 

 

Centralized is more like using SVN

  • clone repo (the command is in the browser usually)
  • making sure you have the latest code git pull origin master (replace master with [branch name] if using branch
  • do your work
  • ADD add your work to the repo (called staging in git langauge)

git add -A adds all changed files in repo
git add . adds all changed files in the directory that your in git add /folder/file.file adds a given file

  • commit this commits the staged change to the local repo git commit Brings up vim for you to enter your commit message if you don't know vim this will just make you angry. Using vim is easy if you know how to do it; hit i to insert text, hit escape to bring up the 'menu', type :qw to write the commit notes to git. git commit -m "notes notes notes" easier way to write commit notes

at this point the changes are staged locally, you can do multiple commits locally before having to push to the central repo.

  • push git push rectifies the central repo with your local repo (more on pull requests later)

Branch Workflow Example

WIP  #TODO

0 Kudos
Message 1 of 1
(2,945 Views)