Changes

Jump to navigation Jump to search
2,498 bytes added ,  20:37, 5 June 2023
no edit summary
Line 166: Line 166:  
       &emsp; &nbsp; You can now continue to code and push/pull to GitHub as needed to track/update changes. Good luck, if it doesn't work don't blame me ... I only work here :) </li><br>
 
       &emsp; &nbsp; You can now continue to code and push/pull to GitHub as needed to track/update changes. Good luck, if it doesn't work don't blame me ... I only work here :) </li><br>
 
</ol>
 
</ol>
 +
 +
== <i>Ignoring Files (.gitignore)</i> ==
 +
There are various reasons to not want to track/push files. Here are some and how to handle them.
 +
<ol>
 +
<!-- Step 1 -->
 +
===Case 1 ===
 +
Case #1 - Trouble pushing files due to being too big (>50 MB, GitHub max) <br>
 +
  <li><u>Find those files</u>: <br>
 +
      &ensp; - Ensure you're in the directory of interest (use <b>cd </b> command as needed) <br>
 +
      &ensp; - Type <b>find . -type f -size +50M </b><br>
 +
      &ensp; - This will list files that are above GitHub's 50 MB limit </li><br>
 +
 +
  <li><u>Create a .gitignore file</u>: <br>
 +
      &ensp; - To create one use the command <b>touch .gitnore </b><br>
 +
      &ensp; &ensp; Make sure you are in the root folder of your repository on your local computer when you use this command <br>
 +
      &ensp; &ensp; Hint - The root folder is named the same as your repository on GitHub </li><br>
 +
 +
  <li><u>Use your favorite text editor to open the file (i.e. Vim, Notepad++, etc.)</u>: <br>
 +
      &ensp; - Enter the oversized files from above into the girignore file<br>
 +
      &ensp; &ensp; Make sure to remove the . if you decide to copy/paste <br>
 +
      <i><u>Example</u>:</i></li>
 +
 +
<!-- Example -->
 +
<pre># Remember: A line that follows # is  a comment.
 +
#
 +
# To ignore a file update this file (.gitignore) then add, commit, and push this file.
 +
# Do this BEFORE any other pushes so the rule will be in effect.
 +
 +
# These files are above GitHub's recommended file size (50 MB). SUBFOLDER/FILE
 +
MonteCarlo/fermi.txt
 +
Examples/mctuple.root
 +
Examples/mctuple.hbook
 +
Examples/ntuple.root
 +
Examples/log
 +
Examples/omega2p_sim_1.itape
 +
Examples/ntuple.hbook
 +
 +
# These are object files. Code that is compiled to machine code, no need fo me to saved/tracked in GitHub.
 +
# * is a wild card, so anything that has .o at the end is ignored using *.o, while *.o.* says ignore anything that has .o. within the name.
 +
*.o
 +
*.o.*
 +
</pre><br>
 +
 +
  <li><u>Ignore already checked in files</u>: <br>
 +
      &ensp; - Since you already tried and failed to fully push those file, you'll need to untrack them <br>
 +
      &ensp; - From your terminal type <b>git rm --cached FILENAME </b><br>
 +
      &ensp; &ensp; Hint - You can copy/paste from the find results <b>git rm --cached /SUBFOLDER/FILENAME </b><br>
 +
      &ensp; - Do this for all files that require it before proceeding </li><br>
 +
 +
 +
# If you want to ignore a file that is already checked in,
 +
# you must untrack the file before you add a rule to ignore it.
 +
# From your terminal, untrack the file:
 +
 +
 +
 +
 +
 +
    
== <u><i>Extras</i></u> ==
 
== <u><i>Extras</i></u> ==
581

edits

Navigation menu