Difference between revisions of "Git Notes"
Dsteinmark (talk | contribs) (Created page with "=== Intro === Notes that describe Git repo creation, usage, maintenance, Need to extend for team based design, but this is start. <pre> 12.22.2015 jjo Created for one-m...") |
Dsteinmark (talk | contribs) |
||
| Line 298: | Line 298: | ||
# distribute you pubkey to Pat B | # distribute you pubkey to Pat B | ||
# using git clone gitolite3@ws-git:<REPO> (or whatever your repo is) | # using git clone gitolite3@ws-git:<REPO> (or whatever your repo is) | ||
| + | |||
| + | |||
| + | [[Category:Programming]] | ||
Revision as of 19:03, 23 October 2018
Intro
Notes that describe Git repo creation, usage, maintenance,
Need to extend for team based design, but this is start.
12.22.2015 jjo Created for one-man repo.
12.28.2015 jjo Added push notes. Changed line <first line> + 3.
Added gitk example at end (lines <fl> + 183).
03.12.2018 jjo Added notes on working with remote repos.
Initialization
<first line>
git init --bare creates repo in this directory root git config - add tags to data --global user.name "your name" --global user.email jolup@lgsinnovations.com --global core.editor emacs git config --list // check settings git config user.name // return user name
Stage your files
git add <file path from root of repo>
Check status of what's staged
Once staged, you should have "Changes to be committed" with list of new files you may have "Untracked files" listing; this should be empty. Everything in repo should be worthy of tracking. If not, move or destroy the extra files.
EX "git status" returns: # On branch master # # Initial commit # # Changes to be committed: # (use "git rm --cached <file>..." to unstage) # # new file: components/AHB_bus.vhd # new file: components/AHB_bus_wrapper.vhd # new file: cpld_slave_wave.do # new file: cpld_wave.do # new file: make_ver.tcl # new file: modelsim.ini # new file: run_cpld_simulation.do # new file: src/SataMux_FPGA_01.vhd # new file: src/SataMux_FPGA_01_DEBUG1.vhd # new file: src/cpld_top.vhd # new file: src/cpld_types_pkg.vhd # new file: src/functions_pkg.vhd # new file: src/qspi_slave_ahb.vhd # new file: src/qspi_slave_ahb_r2.vhd # new file: src/qspi_slave_ahb_r3.vhd # new file: src/spi_slave.vhd # new file: src/test_01.vhd # new file: src/types_pkg.vhd # new file: src/version_pkg.vhd # new file: src/wftp_cpld_r0.vhd # new file: tb/AHB_bus_wrapper_sim.vhd # new file: tb/AHB_bus_wrapper_sim_breakout.vhd # new file: tb/SataMux_FPGA_01.vhd # new file: tb/SataMux_FPGA_01_DEBUG1.vhd # new file: tb/clkgen.v # new file: tb/cpld_qspi_tb.v # new file: tb/cpld_tb.v # new file: tb/cpld_tb_non_ahb.v # new file: tb/functions_pkg.vhd # new file: tb/qspi_master_bfm.v # new file: tb/qspi_slave_ahb.vhd # new file: tb/simple_slave.vhd # new file: tb/spi_slave.vhd # new file: tb/test_01.vhd # new file: tb/test_operations.v # new file: tb/types_pkg.vhd # new file: tb/user_logic.vhd # new file: tb/version_pkg.vhd # new file: tb/wftp_cpld_r0.vhd
Now commit files
bash-4.2$ git commit -m 'Initial CPLD project commit' [master (root-commit) bf88314] Initial CPLD project commit 39 files changed, 14089 insertions(+) create mode 100755 components/AHB_bus.vhd create mode 100644 components/AHB_bus_wrapper.vhd create mode 100755 cpld_slave_wave.do create mode 100755 cpld_wave.do create mode 100755 make_ver.tcl create mode 100644 modelsim.ini create mode 100755 run_cpld_simulation.do create mode 100755 src/SataMux_FPGA_01.vhd create mode 100755 src/SataMux_FPGA_01_DEBUG1.vhd create mode 100644 src/cpld_top.vhd create mode 100644 src/cpld_types_pkg.vhd create mode 100755 src/functions_pkg.vhd create mode 100755 src/qspi_slave_ahb.vhd create mode 100755 src/qspi_slave_ahb_r2.vhd create mode 100644 src/qspi_slave_ahb_r3.vhd create mode 100755 src/spi_slave.vhd create mode 100755 src/test_01.vhd create mode 100755 src/types_pkg.vhd create mode 100755 src/version_pkg.vhd create mode 100755 src/wftp_cpld_r0.vhd create mode 100644 tb/AHB_bus_wrapper_sim.vhd create mode 100644 tb/AHB_bus_wrapper_sim_breakout.vhd create mode 100755 tb/SataMux_FPGA_01.vhd create mode 100755 tb/SataMux_FPGA_01_DEBUG1.vhd create mode 100755 tb/clkgen.v create mode 100644 tb/cpld_qspi_tb.v create mode 100755 tb/cpld_tb.v create mode 100755 tb/cpld_tb_non_ahb.v create mode 100755 tb/functions_pkg.vhd create mode 100755 tb/qspi_master_bfm.v create mode 100755 tb/qspi_slave_ahb.vhd create mode 100755 tb/simple_slave.vhd create mode 100755 tb/spi_slave.vhd create mode 100755 tb/test_01.vhd create mode 100755 tb/test_operations.v create mode 100755 tb/types_pkg.vhd create mode 100755 tb/user_logic.vhd create mode 100755 tb/version_pkg.vhd create mode 100755 tb/wftp_cpld_r0.vhd
Having established the repo, clone it to work with it.
From my perspective, on spock:
git clone cpld_git_repo working // checkout the repo to the 'working' directory.
FEW HOURS LATER, you have a happy point where you should check in code.
Status the working directory
bash-4.2$ cd working bash-4.2$ git status # On branch master # Changes not staged for commit: # (use "git add <file>..." to update what will be committed) # (use "git checkout -- <file>..." to discard changes in working directory) # # modified: cpld_wave.do # modified: tb/cpld_qspi_tb.v # modified: tb/qspi_master_bfm.v # modified: tb/test_operations.v # no changes added to commit (use "git add" and/or "git commit -a")
Once you get used to status, you don't need the verbosity, use -s:
bash-4.2$ git status -s M cpld_wave.do M tb/cpld_qspi_tb.v M tb/qspi_master_bfm.v M tb/test_operations.v
Determine differences between checkout and repo
git diff <file by file, line by line>
Stage files to be committed
bash-4.2$ git add tb/*.v
Verify staging (subtle with the -s status). The indented M is modified file that is not the 'M' files that are not indented (aside from tab) are staged. Add the waveform viewer.
bash-4.2$ git status -s M cpld_wave.do M tb/cpld_qspi_tb.v M tb/qspi_master_bfm.v M tb/test_operations.v
How long form status is (note all are staged now):
bash-4.2$ git add cpld_wave.do bash-4.2$ git status # On branch master # Changes to be committed: # (use "git reset HEAD <file>..." to unstage) # # modified: cpld_wave.do # modified: tb/cpld_qspi_tb.v # modified: tb/qspi_master_bfm.v # modified: tb/test_operations.v #
Since files are staged you can commit changes.
git commit
A text file comes up, where you can write commit notes. this files is git status just before commit.
bash-4.2$ git commit [master 0c80bfb] Added mode to qspi_master_bfm. Corrected functionality for cpld_qspi_tb. Current functionality includes correct register writes / reads using synthesis-proven top level CPLD code. Testbench (cpld_qspi_tb) verified register read / write. JJO 12.22 4 files changed, 111 insertions(+), 92 deletions(-) rewrite cpld_wave.do (78%)
Now, in working dir, status comes up blank. commit complete.
bash-4.2$ git status # On branch master # Your branch is ahead of 'origin/master' by 1 commit. # (use "git push" to publish your local commits) #
Nothing to commit, working directory clean TBD FORMATTING FOR BELOW SECTION
bash-4.2$ git push warning: push.default is unset; its implicit value is changing in Git 2.0 from 'matching' to 'simple'. To squelch this message and maintain the current behavior after the default changes, use: git config --global push.default matching
To squelch this message and adopt the new behavior now, use:
git config --global push.default simple
See 'git help config' and search for 'push.default' for further information. (the 'simple' mode was introduced in Git 1.7.11. Use the similar mode 'current' instead of 'simple' if you sometimes use older versions of Git)
Counting objects: 38, done. Delta compression using up to 40 threads. Compressing objects: 100% (26/26), done. Writing objects: 100% (26/26), 30.43 KiB | 0 bytes/s, done. Total 26 (delta 12), reused 0 (delta 0) To /home/jolup/work/wftp/igloo_cpld_design/cpld_git_repo/ af3b682..5d0932d master -> master bash-4.2$ git status # On branch master nothing to commit, working directory clean bash-4.2$
gitk = nice TK interface to view diffs, look at versions based on sha1. In repo root, simply run gitk.
> gitk
You want to revert to an older version? No problem
First, status the repo (working or master)
bash-4.2$ git log --oneline af3b682 01.21.2015 jjo Added debug ports to the top level fpga. committing the design constraints, top level and slave file. The CPLD is reacting d8ac067 jjo 01.20.15 Corrected physical constraints on the QPSI interface. -- changed to LVCMOS33 from TTL -- slowed ske 6494da3 Added non debug design files - forgot to stage these. fb3c3fd Added design files and constraints that capture state of the spi and bus providing them to pins. Added constraints to the repository. Only core is 38b7aa2 Current testbench operation (12.30 commit - 10 AM jjo)x 61a93f5 12.28 jjo - Bugfix in reg_write process, found testing swrst (problem in dummy_cycles) - Added PLL and tested SPI at 60 MHz, CPLD at 80 MHz. cc65a7f Added command processor in qspi_slave. Extended test operations and bfm to verify transaction count, incl verification. Tested command processor (WR 0c80bfb Added mode to qspi_master_bfm. Corrected functionality for cpld_qspi_tb. Current functionality includes correct register writes / reads using synthe bf88314 Initial CPLD project commit
Where you want to create a prior repo copy (can be current working, but why?), clone.
git clone cpld_git_repo/ cpld_git_last_commit
Now revert in the cpld_git_last_commit
git checkout d8ac067
Wrap up
Above was working with local backed up but informal repos. remote repo established on ws-git (gitolite3)
- distribute you pubkey to Pat B
- using git clone gitolite3@ws-git:<REPO> (or whatever your repo is)