Ask a Question | Search PSRCHIVE: |
Home
|
Git: Quick Guide (for Developers)Clone the PSRCHIVE Git repo using your sf.net username and password.$ git clone ssh://USERNAME@git.code.sf.net/p/psrchive/code psrchiveEach development task (e.g. new feature or bug fix should be performed on a branch—this will naturally separate the work. So, if you are writing a PSRCHIVE application and you are also modifying the Pulsar::Archive class for fun, these two (independent) tasks can be performed in a single Git repo simultaneously by switching branches. $ git status # On branch master nothing to commit (working directory clean)By default, the could would have been pulled the master (default) branch from the Git repo. Let's proceed and create the new psrchive application: 'psrapp'. $ git checkout -b psrapp Switched to a new branch 'psrapp' $ git status # On branch psrapp nothing to commit (working directory clean)Create the new application. $ touch More/Applications/psrapp.C $ git status # On branch psrapp # Untracked files: # (use "git addAdd the code to the Git repo. $ git add More/Applications/psrapp.CCommit the file. $ git commit -m "An awesome new psrchive program that does nothing." [psrapp 264901d] An awesome new psrchive program that does nothing. 0 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 More/Applications/psrapp.C $ ls More/Applications/psrapp.C More/Applications/psrapp.C $ git branch master * psrappSwitch back to the master branch. $ git checkout master Switched to branch 'master'The psrapp.C is now longer present (as it is on the psrapp branch). $ ls More/Applications/psrapp.C ls: cannot access More/Applications/psrapp.C: No such file or directoryBy now, you should get the idea that developing each new feature or bug fix should be performed on separate branches. This will:
$ git merge psrapp Updating 913a8e7..264901d Fast-forward 0 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 More/Applications/psrapp.C $ ls More/Applications/psrapp.C More/Applications/psrapp.CNow, we have our new psrchive program in the master branch. When it is ready for other developers to access, push it into the central Git repo. Don't actually do this command if you're following the walk-through. $ git push origin master
|