Difference between revisions of "Git commands"

From Vrieze Wiki
Jump to navigation Jump to search
Line 16: Line 16:
  
 
Finally, to commit the files to the repo, you can run commit
 
Finally, to commit the files to the repo, you can run commit
  git commit -m "message about commit" ## or
+
<syntaxhighlight lang="bash">
 +
  git commit -m "message about commit" ## to commit
 +
git commit --dry-run -m "message about commit" ## to see what the commit will do first
 +
</syntaxhighlight>

Revision as of 19:14, 18 April 2020

Github is a great place to host code, whether you use it to manage changes, post a final(-ish) version of code, or collaborate and share with others. It can be easier to use git than to email scripts, or point someone to a script on the supercomputer.

Starting a repo

First, you can create a directory (on any computer) and put some files into it. Then to initiate a repo, install git and run something like

git init

Then, to add all the files, run the following (to add specific files just run git add <filename>):

git add .   ## to add all files
git add <filename> ## to add specific files

Finally, to commit the files to the repo, you can run commit

 git commit -m "message about commit" ## to commit
 git commit --dry-run -m "message about commit" ## to see what the commit will do first