Difference between revisions of "Annotated Git session using the sim-recon repository"

From GlueXWiki
Jump to: navigation, search
Line 6: Line 6:
 
Make a local copy of the entire sim-recon repository for myself.  This took about 5 seconds.
 
Make a local copy of the entire sim-recon repository for myself.  This took about 5 seconds.
  
 
+
<pre style="color:darkblue">
<span style="color:blue"><pre>
+
 
cd ~
 
cd ~
 
mkdir git
 
mkdir git
 
cd git
 
cd git
 
git clone https://github.com/JeffersonLab/sim-recon
 
git clone https://github.com/JeffersonLab/sim-recon
</pre></span>
+
</pre>
>
+
 
>
+
Check that the plugin in the repository is what I think it is   
> Check that the plugin in the repository is what I think it is   
+
<pre style="color:darkblue">
>
+
cd sim-recon/src/plugins/monitoring/CDC_online/
> cd sim-recon/src/plugins/monitoring/CDC_online/
+
git status
> git status
+
</pre>
>
+
 
>
+
Copy in my updated file  
> Copy in my updated file  
+
<pre style="color:darkblue">
>
+
cp ~/online/plugins/CDC_online/JEventProcessor_CDC_online.cc .
> cp ~/online/plugins/CDC_online/JEventProcessor_CDC_online.cc .
+
git status
> git status
+
</pre>
> # On branch master
+
<pre style="color:darkgreen">
> # Changed but not updated:
+
# On branch master
> #  (use "git add <file>..." to update what will be committed)
+
# Changed but not updated:
> #  (use "git checkout -- <file>..." to discard changes in working directory)
+
#  (use "git add <file>..." to update what will be committed)
> #
+
#  (use "git checkout -- <file>..." to discard changes in working directory)
> # modified:  JEventProcessor_CDC_online.cc
+
#
> #
+
# modified:  JEventProcessor_CDC_online.cc
>
+
#
>
+
</pre>
> List the changes between this copy and the original and make sure that they are all mine (use space to get to next page)
+
 
> git diff
+
<pre>
>
+
List the changes between this copy and the original and make sure that they are all mine (use space to get to next page)
>
+
git diff
> Make a new branch to contain and label my change
+
 
>
+
 
> git branch cdcpluginupdate
+
Make a new branch to contain and label my change
> git status
+
 
> # On branch master
+
 
> # Changed but not updated:
+
List the changes between this copy and the original and make sure that they are all mine (use space to get to next page)
> #  (use "git add <file>..." to update what will be committed)
+
git diff
> #  (use "git checkout -- <file>..." to discard changes in working directory)
+
 
> #
+
 
> # modified:  JEventProcessor_CDC_online.cc
+
Make a new branch to contain and label my change
> #
+
 
> no changes added to commit (use "git add" and/or "git commit -a")
+
git branch cdcpluginupdate
>
+
git status
>
+
# On branch master
> Switch to the new branch, check the status and list the branches.  
+
# Changed but not updated:
>
+
#  (use "git add <file>..." to update what will be committed)
> git checkout cdcpluginupdate
+
#  (use "git checkout -- <file>..." to discard changes in working directory)
> M src/plugins/monitoring/CDC_online/JEventProcessor_CDC_online.cc
+
#
> Switched to branch 'cdcpluginupdate'
+
# modified:  JEventProcessor_CDC_online.cc
>
+
#
> git status
+
no changes added to commit (use "git add" and/or "git commit -a")
> # On branch cdcpluginupdate
+
 
> # Changes to be committed:
+
 
> #  (use "git reset HEAD <file>..." to unstage)
+
Switch to the new branch, check the status and list the branches.  
> #
+
 
> # modified:  JEventProcessor_CDC_online.cc
+
git checkout cdcpluginupdate
> #
+
M src/plugins/monitoring/CDC_online/JEventProcessor_CDC_online.cc
>
+
Switched to branch 'cdcpluginupdate'
> git branch  
+
 
> * cdcpluginupdate
+
git status
>   master
+
# On branch cdcpluginupdate
>
+
# Changes to be committed:
>
+
#  (use "git reset HEAD <file>..." to unstage)
> Add the file to the list of files to be committed/uploaded to the repository
+
#
> git add JEventProcessor_CDC_online.cc
+
# modified:  JEventProcessor_CDC_online.cc
>
+
#
> git status
+
 
> # On branch cdcpluginupdate
+
git branch  
> # Changes to be committed:
+
* cdcpluginupdate
> #  (use "git reset HEAD <file>..." to unstage)
+
   master
> #
+
 
> # modified:  JEventProcessor_CDC_online.cc
+
 
> #
+
Add the file to the list of files to be committed/uploaded to the repository
>
+
git add JEventProcessor_CDC_online.cc
> Tell git to use my username and email address that I used when joining the GlueX github team
+
 
>
+
git status
> git config --global user.name "Naomi Jarvis"
+
# On branch cdcpluginupdate
> git config --global user.email "nsj@cmu.edu"  
+
# Changes to be committed:
>
+
#  (use "git reset HEAD <file>..." to unstage)
>
+
#
> Commit change to the local repository
+
# modified:  JEventProcessor_CDC_online.cc
>
+
#
> git commit -m "updated cdc_online for fa125 new format"
+
 
>
+
Tell git to use my username and email address that I used when joining the GlueX github team
>
+
 
> Send it to the remote repository.  The first branchname given is the local name, the second is the new name on the remote repo (usually no need to change it).
+
git config --global user.name "Naomi Jarvis"
>
+
git config --global user.email "nsj@cmu.edu"  
> git push origin cdcpluginupdate:cdcpluginupdate  
+
 
> error: The requested URL returned error: 403 Forbidden while accessing https://github.com/JeffersonLab/sim-recon/info/refs
+
 
> fatal: HTTP request failed
+
Commit change to the local repository
>
+
 
> This did not work, check the age of git
+
git commit -m "updated cdc_online for fa125 new format"
>
+
 
> git —version
+
 
> git version 1.7.1
+
Send it to the remote repository.  The first branchname given is the local name, the second is the new name on the remote repo (usually no need to change it).
>
+
 
> Try again from a different computer with a more recent git, as 1.7.1 is known to be problematic
+
git push origin cdcpluginupdate:cdcpluginupdate  
>
+
error: The requested URL returned error: 403 Forbidden while accessing https://github.com/JeffersonLab/sim-recon/info/refs
> git —version
+
fatal: HTTP request failed
> git version 2.5.0
+
 
>
+
This did not work, check the age of git
> git push origin cdcpluginupdate:cdcpluginupdate  
+
 
> Counting objects: 7, done.
+
git —version
> Delta compression using up to 4 threads.
+
git version 1.7.1
> Compressing objects: 100% (7/7), done.
+
 
> Writing objects: 100% (7/7), 1.43 KiB | 0 bytes/s, done.
+
Try again from a different computer with a more recent git, as 1.7.1 is known to be problematic
> Total 7 (delta 6), reused 0 (delta 0)
+
 
> To https://github.com/JeffersonLab/sim-recon
+
git —version
> * [new branch]      cdcpluginupdate -> cdcpluginupdate
+
git version 2.5.0
>
+
 
>
+
git push origin cdcpluginupdate:cdcpluginupdate  
> ONE MORE THING.  Need to issue the pull request on the web page (for someone to approve the addition)
+
Counting objects: 7, done.
>
+
Delta compression using up to 4 threads.
> Go to https://github.com/JeffersonLab/sim-recon and sign in on the RHS.
+
Compressing objects: 100% (7/7), done.
> Below ‘Simulation and Reconstruction for GlueX’ there was a pale yellow box showing the name of my new branch, and on the RHS inside the box was
+
Writing objects: 100% (7/7), 1.43 KiB | 0 bytes/s, done.
> a green button ‘changes and pull request’.  Click it.
+
Total 7 (delta 6), reused 0 (delta 0)
>
+
To https://github.com/JeffersonLab/sim-recon
> Now wait for someone else to merge it. (or not).
+
  * [new branch]      cdcpluginupdate -> cdcpluginupdate
>
+
 
 +
 
 +
ONE MORE THING.  Need to issue the pull request on the web page (for someone to approve the addition)
 +
 
 +
Go to https://github.com/JeffersonLab/sim-recon and sign in on the RHS.
 +
Below ‘Simulation and Reconstruction for GlueX’ there was a pale yellow box showing the name of my new branch, and on the RHS inside the box was
 +
a green button ‘changes and pull request’.  Click it.
 +
 
 +
Now wait for someone else to merge it. (or not).
 +
</pre>

Revision as of 15:42, 14 December 2015


I needed to update one monitoring plugin file, which was in a non-git directory in my home area. This was the best way to go about it.


Make a local copy of the entire sim-recon repository for myself. This took about 5 seconds.

cd ~
mkdir git
cd git
git clone https://github.com/JeffersonLab/sim-recon

Check that the plugin in the repository is what I think it is

cd sim-recon/src/plugins/monitoring/CDC_online/
git status

Copy in my updated file

cp ~/online/plugins/CDC_online/JEventProcessor_CDC_online.cc .
git status
# On branch master
# Changed but not updated:
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#
#	modified:   JEventProcessor_CDC_online.cc
#
List the changes between this copy and the original and make sure that they are all mine (use space to get to next page)
git diff


Make a new branch to contain and label my change


List the changes between this copy and the original and make sure that they are all mine (use space to get to next page)
git diff


Make a new branch to contain and label my change

git branch cdcpluginupdate
git status
# On branch master
# Changed but not updated:
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#
#	modified:   JEventProcessor_CDC_online.cc
#
no changes added to commit (use "git add" and/or "git commit -a")


Switch to the new branch, check the status and list the branches. 

git checkout cdcpluginupdate
M	src/plugins/monitoring/CDC_online/JEventProcessor_CDC_online.cc
Switched to branch 'cdcpluginupdate'

git status
# On branch cdcpluginupdate
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#	modified:   JEventProcessor_CDC_online.cc
#

git branch 
* cdcpluginupdate
  master


Add the file to the list of files to be committed/uploaded to the repository
git add JEventProcessor_CDC_online.cc

git status
# On branch cdcpluginupdate
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#	modified:   JEventProcessor_CDC_online.cc
#

Tell git to use my username and email address that I used when joining the GlueX github team

git config --global user.name "Naomi Jarvis"
git config --global user.email "nsj@cmu.edu" 


Commit change to the local repository

git commit -m "updated cdc_online for fa125 new format"


Send it to the remote repository.  The first branchname given is the local name, the second is the new name on the remote repo (usually no need to change it).

git push origin cdcpluginupdate:cdcpluginupdate 
error: The requested URL returned error: 403 Forbidden while accessing https://github.com/JeffersonLab/sim-recon/info/refs
fatal: HTTP request failed

This did not work, check the age of git

git —version
git version 1.7.1

Try again from a different computer with a more recent git, as 1.7.1 is known to be problematic

git —version
git version 2.5.0

git push origin cdcpluginupdate:cdcpluginupdate 
Counting objects: 7, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (7/7), done.
Writing objects: 100% (7/7), 1.43 KiB | 0 bytes/s, done.
Total 7 (delta 6), reused 0 (delta 0)
To https://github.com/JeffersonLab/sim-recon
 * [new branch]      cdcpluginupdate -> cdcpluginupdate


ONE MORE THING.   Need to issue the pull request on the web page (for someone to approve the addition)

Go to https://github.com/JeffersonLab/sim-recon and sign in on the RHS.
Below ‘Simulation and Reconstruction for GlueX’ there was a pale yellow box showing the name of my new branch, and on the RHS inside the box was
a green button ‘changes and pull request’.  Click it.

Now wait for someone else to merge it. (or not).