Difference between revisions of "GIT Repository"

From Vlsiwiki
Jump to: navigation, search
(Setup)
(Setup)
 
(15 intermediate revisions by 4 users not shown)
Line 5: Line 5:
 
  git config --global user.name  "Your Username"
 
  git config --global user.name  "Your Username"
 
  git config --global user.email foo@soe.ucsc.edu
 
  git config --global user.email foo@soe.ucsc.edu
 +
 +
Enable colors (optional):
 +
 +
git config --global color.diff auto
 +
git config --global color.status auto
 +
git config --global color.branch auto
 +
 +
Checkout/clone once PAPERS
 +
 +
git clone ssh://mada0.cse.ucsc.edu/mada/server/git/papers.git
  
 
Checkout/clone once ESESC
 
Checkout/clone once ESESC
  
  git clone ssh://mada0.cse.ucsc.edu/mada/server/git/esesc
+
  git clone gitosis@mada0.cse.ucsc.edu:esesc.git
  
 
Checkout/clone once MTHD
 
Checkout/clone once MTHD
Line 21: Line 31:
  
 
  git clone git://mada0.cse.ucsc.edu/synos.git
 
  git clone git://mada0.cse.ucsc.edu/synos.git
 +
 +
Checkout/clone once ACP
 +
 +
git clone ssh://mada0.cse.ucsc.edu/mada/server/git/acp.git
 +
 +
Checkout/clone once MASCRTL
 +
 +
git clone gitosis@mada0.cse.ucsc.edu:mascrtl.git
 +
 +
Checkout/clone once Live
 +
 +
git clone gitosis@mada0.cse.ucsc.edu:live
  
 
===Operation===
 
===Operation===
Line 26: Line 48:
  
 
  git status
 
  git status
 +
 +
To undo the local changes (NOTE: this will delete your local foo file, be careful)
 +
 +
git checkout foo
  
 
Every day synchronize with other people modifications
 
Every day synchronize with other people modifications
Line 47: Line 73:
  
 
  git reset --hard HEAD
 
  git reset --hard HEAD
 +
 +
To delete all untracked files
 +
 
 +
git clean -f
  
 
To see the current changes still not committed against the last commit (HEAD)
 
To see the current changes still not committed against the last commit (HEAD)
Line 55: Line 85:
  
 
  git diff HEAD^
 
  git diff HEAD^
 +
 +
===Branch===
 +
To create a branch and switch to it, type in
 +
 +
git branch branch_name
 +
git checkout branch_name
 +
 +
or in a single line:
 +
 +
git checkout -b branch_name
 +
 +
To remove/delete a branch
 +
 +
git branch -D branch_name
 +
 +
To switch from branch to the master copy
 +
 +
git Commit on the changes that you have made to make sure your current branch directory is clean.
 +
git checkout master
 +
 +
Now, if you want to merge you branch with the master
 +
git merge branch_name
 +
Else, do
 +
git pull
 +
 +
To locate yourself
 +
 +
git branch
 +
The one that is marked by the star is your current branch.
  
 
===QEMU Inclusion in ESESC===
 
===QEMU Inclusion in ESESC===
Line 74: Line 133:
  
 
  git remote add -f qemu-mainline git://git.savannah.nongnu.org/qemu.git
 
  git remote add -f qemu-mainline git://git.savannah.nongnu.org/qemu.git
 +
 +
Alternatively, we can add as "remote" a fresh checkout. The reason is that qemu has submodules, and merge does not like it.
 +
 +
# Clone esesc
 +
git clone ssh://mada0.cse.ucsc.edu/mada/server/git/esesc
 +
 +
# Clone qemu
 +
git clone git://git.qemu.org/qemu.git
 +
cd qemu
 +
rm .gitmodules
 +
#Do a backup if you want
 +
#mv roms/vgabios ../
 +
#mv roms/seabios ../
 +
git commit -a -m"no submodules"
 +
 +
# Add the remote branch
 +
cd esesc
 +
git remote add -f qemu-mainline ../qemu/
 +
 +
# Sync esesc to the new qemu
 +
git pull -s subtree qemu-mainline master
 +
 +
One thing is that you may need to patch by hand (remote the submodules) inside qemu (seabios, vgabios)
  
 
===SYNOS vs SCOORE===
 
===SYNOS vs SCOORE===
Line 101: Line 183:
 
If you do not have write commits to synos, create a patch and send it to the MASC group
 
If you do not have write commits to synos, create a patch and send it to the MASC group
  
  git diff ucsc >patch
+
  git diff --binary ucsc/master ./scripts/ ./memcell ./docs ./storage >../patch
  
 
Make sure that you include only the files that you want to send. E.g:
 
Make sure that you include only the files that you want to send. E.g:
  
  git diff ucsc -- memcell >patch.memcell
+
  git diff ucsc/master -- memcell >patch.memcell
 +
 
 +
To apply the patch in the ucsc repository. E.g:
 +
 
 +
git apply --binary ../patch
 +
 
 +
====How to Remove a File that Should have Never been Committed====
 +
 
 +
If you committed a file to the repository that should have never been committed because it had secret information, you should go to the main repository and delete it.
 +
 
 +
git pull
 +
git filter-branch -f --index-filter "git update-index --remove memcell/libs/SRAM_4096x2_cacti_90.lib" HEAD

Latest revision as of 18:36, 12 September 2017

Setup

You need to setup your name and email

git config --global user.name  "Your Username"
git config --global user.email foo@soe.ucsc.edu

Enable colors (optional):

git config --global color.diff auto
git config --global color.status auto
git config --global color.branch auto

Checkout/clone once PAPERS

git clone ssh://mada0.cse.ucsc.edu/mada/server/git/papers.git

Checkout/clone once ESESC

git clone gitosis@mada0.cse.ucsc.edu:esesc.git

Checkout/clone once MTHD

git clone ssh://mada0.cse.ucsc.edu/mada/server/git/mthd

Checkout/clone once SCOORE

git clone ssh://mada0.cse.ucsc.edu/mada/server/git/scoore.git

Checkout/clone once SYNOS (the public branch of SCOORE)

git clone git://mada0.cse.ucsc.edu/synos.git

Checkout/clone once ACP

git clone ssh://mada0.cse.ucsc.edu/mada/server/git/acp.git

Checkout/clone once MASCRTL

git clone gitosis@mada0.cse.ucsc.edu:mascrtl.git

Checkout/clone once Live

git clone gitosis@mada0.cse.ucsc.edu:live

Operation

To see changes from local re-vision compared to main repo... similar to svn status

git status

To undo the local changes (NOTE: this will delete your local foo file, be careful)

git checkout foo

Every day synchronize with other people modifications

git pull

Whenever you perform a task commit the changes

git commit -a

Remember that a commit does not make the changes visible. Do frequent pushes to the server

git push

To add/rename files uses the git command

git mv foo foo2
git add foo.cpp

If you did something in the local repository that it is wrong, and you want to revert the edits (equivalent to svn revert -R .)

git reset --hard HEAD

To delete all untracked files

git clean -f

To see the current changes still not committed against the last commit (HEAD)

git diff HEAD

To see the current changes against the last against the previous to last commit (HEAD^)

git diff HEAD^

Branch

To create a branch and switch to it, type in

git branch branch_name
git checkout branch_name 

or in a single line:

git checkout -b branch_name

To remove/delete a branch

git branch -D branch_name

To switch from branch to the master copy

git Commit on the changes that you have made to make sure your current branch directory is clean.
git checkout master

Now, if you want to merge you branch with the master

git merge branch_name

Else, do

git pull

To locate yourself

git branch 

The one that is marked by the star is your current branch.

QEMU Inclusion in ESESC

ESESC includes code from the QEMU git repository. This is merged into the ESESC repository using the subtree merge strategy.

The initial steps to merge the qemu git repository were:

git remote add -f qemu-mainline git://git.savannah.nongnu.org/qemu.git
git merge -s ours --no-commit qemu-mainline/master
git read-tree --prefix=emul/qemu/ -u qemu-mainline/master
git commit -m "adding qemu-mainline code"

Getting updates from QEMU git is done with

git pull -s subtree qemu-mainline master

Since QEMU is already included in ESESC the initial configuration steps are not all needed for new repository clones. The only step needed is add the remote ref:

git remote add -f qemu-mainline git://git.savannah.nongnu.org/qemu.git

Alternatively, we can add as "remote" a fresh checkout. The reason is that qemu has submodules, and merge does not like it.

# Clone esesc 
git clone ssh://mada0.cse.ucsc.edu/mada/server/git/esesc
# Clone qemu
git clone git://git.qemu.org/qemu.git
cd qemu
rm .gitmodules 
#Do a backup if you want
#mv roms/vgabios ../
#mv roms/seabios ../
git commit -a -m"no submodules"
# Add the remote branch
cd esesc 
git remote add -f qemu-mainline ../qemu/
# Sync esesc to the new qemu
git pull -s subtree qemu-mainline master

One thing is that you may need to patch by hand (remote the submodules) inside qemu (seabios, vgabios)

SYNOS vs SCOORE

SYNOS repository is the public version of SCOORE. SCOORE is regularly updated with patches sent to SYNOS, and once the code is stable, code from SCOORE is updated in SYNOS.

Merge Code from SYNOS to SCOORE

First, you should add the SYNOS as a remote branch in your SCOORE local repository

git remote add ucsc git://mada0.cse.ucsc.edu/synos.git
git fetch ucsc

Second, you should create a branch in the local SCOORE repository that tracks the remote SYNOS repository

git checkout --track -b ucsc remotes/ucsc/master

Third, you should merge/import all the SYNOS edits to the latest SCOORE master branch

git checkout master
git merge ucsc
git config push.default matching
git push

Merge Code from SCOORE to SYNOS

If you do not have write commits to synos, create a patch and send it to the MASC group

git diff --binary ucsc/master ./scripts/ ./memcell ./docs ./storage >../patch

Make sure that you include only the files that you want to send. E.g:

git diff ucsc/master -- memcell >patch.memcell

To apply the patch in the ucsc repository. E.g:

git apply --binary ../patch

How to Remove a File that Should have Never been Committed

If you committed a file to the repository that should have never been committed because it had secret information, you should go to the main repository and delete it.

git pull
git filter-branch -f --index-filter "git update-index --remove memcell/libs/SRAM_4096x2_cacti_90.lib" HEAD