From a760023f43f09bf47d07dfd6975fba9c9d8187fb Mon Sep 17 00:00:00 2001 From: Giovanni Bussi <giovanni.bussi@gmail.com> Date: Wed, 6 Apr 2011 09:59:32 +0200 Subject: [PATCH] Added short documentation for git newcomers --- README.git | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 README.git diff --git a/README.git b/README.git new file mode 100644 index 000000000..513191c26 --- /dev/null +++ b/README.git @@ -0,0 +1,66 @@ +Clone the repository +$git clone git+ssh://gbussi@qe-forge.org/scmrepos/git/plumed2/plumed2.git +$cd plumed2 + +Stay up to date +$git pull + +Make a small fix (working locally) +$git add FILENAME # always necessary, not only with new files +$git commit FILENAME + +Share it (needs internet connection) +$git pull # always check if you are up-to-date +$git push + +Look at what's happening +$git log +or better +$gitk --all + +Start working on a new feature, opening a new branch +$git checkout -b new-feature + +Check the present branches +$git branch + +And switch among them +$git checkout master +$git checkout new-feature + +Do a commit on your new-feature branch +$git checkout new-feature +$ ... edit files ... +$git add NEWFILE +$git commit NEWFILE + +Merge recent work from the master branch, doing a "rebase" +$git checkout master +$git pull # to stay up-to-date with remote work +$git checkout new-feature +$git rebase master + +After several commits, your new feature is ready for merge. +$git checkout master +$git pull # to stay up-to-date with remote work +$git checkout new-feature +You can squeeze your commits with: +$git rebase -i master +then interactively picking your commits (follow onscreen instructions) +(Without -i, all the commits are retained) +Merge your work into master branch +$git checkout master +$git merge new-feature +Remove the branch +$git branch -d new-feature +Analyze the results +$gitk --all +If everything seems right, push your master branch to the central repository +$git push + +##### + +All these things can be done with a GUI: +$git gui + + -- GitLab