Show Menu
Cheatography

Absolute Beginners Guide to Git and LabVIEW Cheat Sheet by

For LabVIEW programmers who are complete beginners at Git.

First Time Setup

Name
git config --global user.name “<n­ame­>”
Email
git config --global user.email “<e­mai­l>”

Setup your first repository

1. Create a folder
mkdir <my­cod­e> && cd <my­cod­e>
2. Initialize
git init -b main
3. Add files to track
vi readme.md
4. Track files
git add .
5. Initial Commit
git commit -am"­Initial Commit­"

Create a Bare Repository (to use as a remote)

1.
mkdir <my­rep­o.g­it> && cd <my­rep­o.g­it>
2.
git init --bare

Clone An Existing Repository

git clone <ur­l_o­r_f­ile­_pa­th>

Getting Around

I need help.
git help
What is going on in my repo?
git status
What happened in the past?
git log
Can I see a history graph?
git log --oneline --graph
What changed?
git diff
How to configure things?
git config
How to manage branches?
git branch
How to manage remotes?
git remote

Resources

 

Creating a Commit

1. Add all changes
git add .
2. Make a commit
git commit -am"­Commit Messag­e"

Seeing What Changed

List changed files
git diff --name­-only
Open LVCompare
git difftool
What changed in a commit?
git show <co­mmi­t>
Which commits changed a file?
git log -- <fi­le>

Undoing Changes

Throw away all
git restore .
Throw away one file
git restore <fi­le>
Undo
add file
git restore --staged <fi­le>
Go back to commit
git reset --hard <co­mmi­t>
Reset file to commit
git checkout <co­mmi­t> -- <fi­le>
Undo published commit
git revert <co­mmi­t>

Branches

New branch
git switch -C <ne­w_b­ran­ch>
Change branch
git switch <ot­her­_br­anc­h>
Combine changes
git merge <ot­her­_br­anc­h>

Syncing With Remotes

Push changes up
git push
Pull changes down
git pull
Push a new branch
git push -u origin <my­bra­nch>

LabVIEW Specific Tips

Ignore *.aliases and *.lvlps files using .gitignore
Separate Compiled Code.
Merge conflicts are painful. Avoid changing the same file in parallel.
*.lvclass, *.lvlib and *.lvproj can contain binary data.
Close your lvproj before switching branches or reverting changes.
Consider mulitple lvproj to avoid confilcts.
   
 

Comments

No comments yet. Add yours below!

Add a Comment

Your Comment

Please enter your name.

    Please enter your email address

      Please enter your Comment.

          Related Cheat Sheets

          EQ tips Cheat Sheet
          AngularJS Cheat Sheet
          Git-svn for Beginners Cheat Sheet