project_management:git
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revision | |||
| project_management:git [2010/11/21 10:16] – aorth | project_management:git [2020/01/30 12:53] (current) – removed aorth | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== git ====== | ||
| - | git is a distributed version control system originally written by Linus Torvalds. | ||
| - | |||
| - | * Official homepage: http:// | ||
| - | * Pro Git book: http:// | ||
| - | * Cheat sheet: http:// | ||
| - | * git ready: http:// | ||
| - | |||
| - | ====== Installing git ====== | ||
| - | |||
| - | ====== Migrating from SVN ====== | ||
| - | * Reference: http:// | ||
| - | |||
| - | ===== Install git-svn ===== | ||
| - | < | ||
| - | |||
| - | ===== Create a temp git repo ===== | ||
| - | This is where we will initially copy the SVN repository. | ||
| - | |||
| - | < | ||
| - | $ cd beca_lims_portal_temp</ | ||
| - | |||
| - | ==== Initialize temp git repo ==== | ||
| - | |||
| - | < | ||
| - | |||
| - | ===== Map SVN users to git ===== | ||
| - | |||
| - | ==== Create an authors file ==== | ||
| - | /// | ||
| - | < | ||
| - | aorth = Alan Orth < | ||
| - | root = Alan Orth < | ||
| - | akihara = Absolomon Kihara < | ||
| - | |||
| - | ==== Tell git about your authors ==== | ||
| - | < | ||
| - | |||
| - | ===== Populate the temp git repo ===== | ||
| - | < | ||
| - | |||
| - | ===== Clone from the temp repo ===== | ||
| - | When doing a normal git clone it will take everything we want from the temporary repository, while leaving behind all the SVN cruft that was there to support the git-svn | ||
| - | |||
| - | < | ||
| - | $ git clone beca_lims_portal_temp beca_lims_portal</ | ||
| - | |||
| - | ===== See the commit history ===== | ||
| - | You should see all your authors mapped from the SVN repository: | ||
| - | < | ||
| - | $ git log</ | ||
| - | ====== Tagging ====== | ||
| - | Git uses two main types of tags: lightweight and annotated. A lightweight tag is very much like a branch that doesn’t change — it’s just a pointer to a specific commit. Annotated tags, however, are stored as full objects in the Git database. They’re checksummed; | ||
| - | |||
| - | < | ||
| - | |||
| - | See: | ||
| - | * http:// | ||
| - | * http:// | ||
| - | |||
| - | ===== Tagging the current version ===== | ||
| - | < | ||
| - | ===== Tagging a past version ===== | ||
| - | Specify a certain commit by giving the commit' | ||
| - | < | ||
| - | |||
| - | ===== Pushing tags to origin ===== | ||
| - | By default '' | ||
| - | |||
| - | ==== Certain tag ==== | ||
| - | < | ||
| - | |||
| - | ==== All tags ==== | ||
| - | Push all tags which are not already on the remote origin: | ||
| - | < | ||
| - | |||
| - | ==== Reverting a file to a particular revision ==== | ||
| - | If you want to revert a file in the current working revision to a past revision | ||
| - | < | ||
| - | |||
| - | ====== Tips ====== | ||
| - | |||
| - | ===== Edit a commit ===== | ||
| - | To edit a commit (like fixing a spelling or logic mistake): | ||
| - | - Look at '' | ||
| - | - Start the interactive rebase process, pasting in the characters from the ID: git rebase --interactive ID | ||
| - | - Your editor will come up with several lines like '' | ||
| - | - Change the word " | ||
| - | - Save and quit. | ||
| - | - Edit your project files to make the correction, then run git commit --all --amend | ||
| - | - After you’ve committed the fixed version, do git rebase --continue | ||
| - | |||
| - | ===== Change the last commit' | ||
| - | Sometimes you commit something without realizing you haven' | ||
| - | < | ||
| - | commit 85f761ec52e4be90acd2dc7c9f5842e36ad7d783 | ||
| - | Author: Alan Orth < | ||
| - | Date: Sun Nov 21 05:07:48 2010 -0500 | ||
| - | |||
| - | Initial Import of DSpace 1.6.2 | ||
| - | $ git commit --amend --author 'Alan Orth < | ||
| - | ... vim/nano will pop up, save the commit | ||
| - | $ git log -n1 | ||
| - | commit 85f761ec52e4be90acd2dc7c9f5842e36ad7d783 | ||
| - | Author: Alan Orth < | ||
| - | Date: Sun Nov 21 05:07:48 2010 -0500 | ||
| - | |||
| - | Initial Import of DSpace 1.6.2</ | ||
| - | ===== Assume file unchanged ===== | ||
| - | Certain files, like database configuration files, need to be tracked but you don't want to push changes to the remote repo. This is different than using a '' | ||
| - | |||
| - | See: http:// | ||
| - | |||
| - | < | ||
| - | |||
| - | ===== Assume file changed ===== | ||
| - | The opposite of the above: | ||
| - | < | ||
| - | |||
| - | ====== Configuration ====== | ||
| - | |||
| - | ===== ~/ | ||
| - | |||
| - | ==== Set a default editor ==== | ||
| - | The editor is used when you have to enter a commit message. | ||
| - | < | ||
| - | editor = vim</ | ||
| - | ==== Colorize git output ==== | ||
| - | < | ||
| - | ui = auto | ||
| - | [color " | ||
| - | current = yellow reverse | ||
| - | local = yellow | ||
| - | remote = green | ||
| - | [color " | ||
| - | meta = yellow bold | ||
| - | frag = magenta bold | ||
| - | old = red bold | ||
| - | new = green bold | ||
| - | [color " | ||
| - | added = yellow | ||
| - | changed = green | ||
| - | untracked = cyan</ | ||
| - | | ||
| - | ==== Check the current git configurations ==== | ||
| - | < | ||
project_management/git.1290334574.txt.gz · Last modified: by aorth
