GIT: Difference between revisions
import>Ajwt3 No edit summary |
No edit summary |
||
Line 35: | Line 35: | ||
$ ssh ch-thom@git.csx.cam.ac.uk perms -h |
$ ssh ch-thom@git.csx.cam.ac.uk perms -h |
||
==Git prompts== |
|||
If you wish to reach a higher level of git mastery, it's often helpful to have git show what your current checked out branch is in your command line. |
|||
You'll need to put the .gitprompt.bash script your home directory. [There may be updates available to this if anybody would like to look] |
|||
<pre> |
|||
scp carpathia:~ajwt3/.gitprompt.bash ~ |
|||
</pre> |
|||
I have these lines in my .bashrc (which invoke a little more magic than just git prompt) |
|||
<pre> |
|||
. ~/.gitprompt.bash |
|||
export UN=`uname -r |sed 's/(.*)//'` |
|||
export PS1='\[\e]0;\u@\h:\w\a\]\n\[\e[32m\]\u@\h:\[\e[33m\]\w$(__git_ps1 " [%s]")\[\e[0m\]\$ ' |
|||
</pre> |
|||
--[[User:Ajwt3|ajwt3]] ([[User talk:Ajwt3|talk]]) 10:20, 13 September 2016 (BST) |
Revision as of 09:20, 13 September 2016
A GIT repository is a data management system for your files. It is useful for version control.
- First of all, in the directory you wish to make the repository, type 'git init'
- To add a file to the repository, type 'git add filename'
- To commit changes to the repository, type 'git commit filename'. This will bring up a text file where it is possible to record details of the changes.
- To retrieve a file from the repository, type 'git checkout filename'
Tutorial
There are many tutorials available. Here's one that looked interesting
https://www.atlassian.com/git/tutorials/
Group git server
- Accessible at ch-thom@git.csx.cam.ac.uk
- see https://git.csx.cam.ac.uk/users.html
- To create your own user repository (assuming your crsid is abc123)
$ ssh ch-thom@git.csx.cam.ac.uk create u/abc123/testing
$ git clone ch-thom@git.csx.cam.ac.uk:u/abc123/testing
$ ssh ch-thom@git.csx.cam.ac.uk
This command allows you to list permissions:
$ ssh ch-thom@git.csx.cam.ac.uk perms u/abc123/testing -lr
This command allows you to change permissions:
$ ssh ch-thom@git.csx.cam.ac.uk perms -h
Git prompts
If you wish to reach a higher level of git mastery, it's often helpful to have git show what your current checked out branch is in your command line. You'll need to put the .gitprompt.bash script your home directory. [There may be updates available to this if anybody would like to look]
scp carpathia:~ajwt3/.gitprompt.bash ~
I have these lines in my .bashrc (which invoke a little more magic than just git prompt)
. ~/.gitprompt.bash export UN=`uname -r |sed 's/(.*)//'` export PS1='\[\e]0;\u@\h:\w\a\]\n\[\e[32m\]\u@\h:\[\e[33m\]\w$(__git_ps1 " [%s]")\[\e[0m\]\$ '