GIT: Difference between revisions

From Thom Group Wiki
Jump to navigation Jump to search
import>Hb407
(Created page with "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 "ini...")
 
 
(15 intermediate revisions by 3 users not shown)
Line 1: Line 1:
[[File:git.png|link:http://xkcd.com/1597/]]

A GIT repository is a data management system for your files. It is useful for version control.
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"'
#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 are two that look interesting

https://www.vogella.com/tutorials/Git/article.html

https://www.atlassian.com/git/tutorials/

== Group gitlab server ==

# Accessible at https://gitlab.developers.cam.ac.uk/ch/thom

It's '''essential''' to create an additional non-Raven identity by Editing your profile, which enables gitlab access after having left.

A useful piece of workflow advice: If you want to suggest some specific code changes to a Merge request, you can branch off the branch and create a new (sub-)merge request to merge into the original

==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)
#To add a file to the repository, type 'git "filename"'


<pre>
#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.
. ~/.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)
#To retrieve a file from the repository, type 'git checkout "filename"'

Latest revision as of 10:48, 5 April 2022

link:http://xkcd.com/1597/

A GIT repository is a data management system for your files. It is useful for version control.

  1. First of all, in the directory you wish to make the repository, type 'git init'
  2. To add a file to the repository, type 'git add filename'
  3. 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.
  4. To retrieve a file from the repository, type 'git checkout filename'

Tutorial

There are many tutorials available. Here are two that look interesting

https://www.vogella.com/tutorials/Git/article.html

https://www.atlassian.com/git/tutorials/

Group gitlab server

  1. Accessible at https://gitlab.developers.cam.ac.uk/ch/thom

It's essential to create an additional non-Raven identity by Editing your profile, which enables gitlab access after having left.

A useful piece of workflow advice: If you want to suggest some specific code changes to a Merge request, you can branch off the branch and create a new (sub-)merge request to merge into the original

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\]\$ '

--ajwt3 (talk) 10:20, 13 September 2016 (BST)