Git commands: Difference between revisions

From Vrieze Wiki
Jump to navigation Jump to search
Created page with "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 g..."
 
No edit summary
Line 4: Line 4:


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
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
<syntaxhighlight lang="bash">
git init
</syntaxhighlight>


Then, to add all the files, run the following (to add specific files just run git add <filename>):  
Then, to add all the files, run the following (to add specific files just run git add <filename>):  
git add .
 
<syntaxhighlight lang="bash">
git add .   ## to add all files
git add <filename> ## to add specific files
</syntaxhighlight>
 
Finally, to commit the files to the repo, you can run commit
git commit -m "message about commit" ## or

Revision as of 19:13, 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" ## or