Version 14 (modified by 10 years ago) ( diff ) | ,
---|
One can check out the golden version of the code with the command,
git clone ssh://orda@botwin.pas.rochester.edu/astrobear
This puts a local copy of the last release of the code (called the 'Master' branch) in your current working directory, in a folder named astrobear. Switching into the folder astrobear, you can see the branch's name with the command,
git branch
which shows you the current branch you are on (marked by an '*') out of the list of local branches you have checked out. If you just cloned the repo, the only branch in this list is the master. But you can see all the branches of the larger repo of the code, by giving the command,
git branch -a
Now, to do development, one switches to the development branch of the code, which is the 'living' part of the code (i.e. that which is being developed, tested, and updated) that exists between golden releases of the code.
You switch to different branches (to the development branch in this example) with the command,
git checkout development
Giving
git branch
Now shows you have 2 local checked out versions of the code, master and development, and that you are currently sitting in the development branch (marked by an '*').
From there, if you want to begin making changes to the code, you must create a new branch off of the development branch, for which you will later merge (see below) with the development branch after your edits have been tested.
git checkout -b your_new_branch
This will take the current version of the development code and create an offshoot of it (i.e. a copy of it) for you to then work with.
This new branch is only a local copy, meaning that if you were to delete your directory, your branch (and all of its changes) would cease to exist (i.e. no copy of it is yet present in the central repo), and that no one else can see it. So, in order to sync your local copy with the main repo, you want to push (i.e. copy) this branch into the central repo,
git push -u origin your_new_branch
Now others would see your branch if they downloaded a clean version of the repo, or updated theirs with,
git pull git branch -a
After that initial push, one only needs to do a simple
git push
to update the central repo with new edits. Before that however, one should "add" and "commit" changes to their local copies, or else nothing new will be available to be pushed.
Now, what does "add" mean anyway — it means "staging" changes to be committed, i.e., making them available to be committed. After one has edited some files in their branch, they can give the command,
git status
This shows ALL of the uncommitted edits of your branch. It reports a ton of uninteresting files after you compile — object (.o) files and the like that are never going to be committed to the central repo and are therefore named 'untracked' files. To get rid of these uninteresting files, use the option -uno,
git status -uno
This will now report a list of changes you made since the last commit. If you want to diff the version of any of these files with previous commit's versions, you would use the command
git diff filename prev_revision
Note, as you go on to make changes to this branch, they will be local until you commit and push those changes back into the central repo. (cf. here for details).
To keep track of your changes, you give the command,
git status
Now, the procedure for pushing changes into the development branch goes as follows. Once your changes are ready to go into the dev branch, you want to switch back to the development branch and update it so that your changes are going to be merged with the newest version of the dev branch. You do this with,
git checkout development git pull
Once you have done this, then you want to merge it with your working branch,
git merge your_new_branch
Once this is merged, you then want to push those changes back into the repo.,
git push
? What about your pushing your ticket branch back into the central repo after it has been merged? Or does command, git push, push *all* of your local repos back into the main repo?
?I think you can only push changes back into the central repo that have been 'checked in', right?
Once you are done with your edits, you can delete your local copies of the repos with,
git delete
(although, why is this necessary, can't you just delete your local copies by deleting the whole directory?)
and can delete your branch in the central repo with the command,
Attachments (1)
- branch_drawing.png (54.0 KB ) - added by 10 years ago.
Download all attachments as: .zip