On Sat, Apr 21, 2012 at 05:56:10AM +1200, Ralph Versteegen wrote: > Are you planning on using git-svn? If so, you should say so, it > completely changes the workflow. No merging or remotes, lots of > rebasing.
Yes, I was thinking of that. In the long term, I would like to retire the gilgamesh server, and git seems like a good path to that end. I still want to have a central master copy, but I figure that could be on hitorious or something similar, rather than anything I attempt to host myself. > On 19 April 2012 06:12, Mike Caron <[email protected]> wrote: > > Whoops, I am remiss, and forgot a few things: > > > > - "origin" is what is known as a "remote". This might be a > > colleague's computer, or it might be a central server (I only have > > experience with the latter). By default, the remote is named "origin". > > So, when you're dealing with remote branches that live on "origin", > > they will be prefixed with "origin/" > > > > - a branch in your local repo ("master") is independant of the branch > > on origin ("origin/master"). This makes sense, because you can commit > > to your local branch without affecting others, and vice-versa. But, it > > was non-obvious for me. > > I found this pretty confusing too, and I'm still not entirely > comfortable working with remotes. > > But I'll point out (though this is getting into advanced territory) > that there are usually *three* copies of a remote branch: the actual > branch on the remote machine (don't be fooled, unlike in svn you can > not directly access these, first you have to copy them to your > machine), your copy of the remote branch (named remotename/branchname > e.g. origin/master), and your personal copy of the branch (e.g. > 'master'), (called a 'remote tracking' branch) which is the one you > modify. > > But any of these three copies might not exist, and you can actually > modify 'origin/master' -- I've done that by accident a few times. What are the consequences of modifying origin/master? > > - because of this, when you update your local repo (git merge), > > you're performing the exact same operation as merging a branch into > > your branch (because you are). This includes nastiness like merge > > conflicts, but also good things like updating history. > > > > - adding a file (git add) does not have the same semantics as it does > > in subversion. Specifically, adding a file only marks it for staging. > > That is, it says "next time I commit, include this file". Already > > existing files still need to be added when you want to commit their > > changes. Conversely, if you don't want to commit certain files, you > > can just not add them. > > Staging was the most confusing thing to me. SVN and Hg supposedly have > nothing like it. This really needs to be understood, otherwise too > many commands don't make sense. > > You'll see references in the documentation to the "index" or the > "staging file" (same thing). In reality, the staging area is a copy of > all checked in files. Think of it as a second working copy hidden > somewhere in the .git directory. Your working copy, the staging area, > and the current commit (called HEAD) are all totally independent. I > frequently end up with a garbage staging area* (eg. copy of the wrong > commit) and need to 'reset' it Some git commands have really > confusing actions, it's because they act on one of the three rather > than what their names imply: > > *I'm totally reckless with git with rebases and resets galore, because > I know I can fix a totally stuffed up history > > git add ONLY modifies the staging area. (Adds a file to it) > git checkout can either change all three at once (checking out a > branch), or just copies from the staging area to the working copy > (checking out a file). And it does a whole lot else too > git reset by default modifies just the staging area, even if you pass > it a commit (that's why 'git reset file' undoes changes to the staging > copy), but has lots of arguments for operating on any/all three. > git commit copies from the staging area to create a new commit... > unless you explicitly pass filenames! > > git diff by default shows differences between the working copy and the > staging area (as Mike mentioned, --cached to compare staging area and > HEAD instead). Also can diff any two things. > > Hint: try 'git add -i' (interactive). Gives you a nice menu. > > > - Other useful git commands: > > > > git diff #show uncommitted changes > > git diff --cached #show staged, but uncommitted changes (i.e., only > > what you've added) > > git blame path/to/file #see who done what when > > git log #review older commits > > git reset path/to/file #un-add a file > > git reset --hard #nuke your changes from orbit (make everything clean > > again) > > > > > > On Wed, Apr 18, 2012 at 2:00 PM, Mike Caron <[email protected]> wrote: > >> The thing to remember about git is that it's all about branches. You > >> are always on a branch, usually called master (but that varies, of > >> course). So, I will use master as the branch name below. > >> > >> To update your repo, you need to do this: > >> > >> git fetch #pulls changes from "origin" > >> git merge origin/master #updates working copy > >> > >> To commit changes, you just need to do this: > >> > >> git add path/to/file #adds a file > >> git add -u #adds all changed files > >> git add -a #adds all non-ignored files > >> git commit -m "your message goes here" > >> > >> (obviously, pick whatever add command is most appropriate) > >> > >> Lastly, to push your changes back to origin, just do this: > >> > >> git push origin master > >> > >> (if your branch is not up to date, you will need to refresh it as above) > >> > >> That's all you need to know to get started. However, I strongly > >> suggest you learn git's branching mechanics, because they are really > >> powerful and really useful. At my work, we use a branch per > >> ticket/bugfix, and it works beautifully. > >> > >> Sent from my iPad > >> > >> On 2012-04-18, at 12:56 PM, James Paige <[email protected]> wrote: > >> > >>> I figure if I am ever going to learn to use git, I need to learn how to > >>> replicate my existing svn usgae patterns with git. I have been told many > >>> times that git's functionality is a superset of svn's so this should be > >>> no problem. > >>> > >>> My trouble is that every tutorial I can find, even the ones that are > >>> supposedly intended for recent converts from svn seem to want me to jump > >>> right in to gits more advanced features, and discard my old workflows. > >>> > >>> I would much rather first get used to using git exactly thew same way I > >>> use svn, and then when I am confortable with that, I can start learning > >>> the new fancy things that make git special. > >>> > >>> I have two different workflows for svn repositories > >>> > >>> 1) I have read only access, and I am not changing anything. All I want > >>> to do is keep my local copy up-to-date with upstream. With svn I just > >>> do: > >>> > >>> svn cleanup > >>> svn update > >>> > >>> in a cron job, and all is happy. However, I am not clear on how to do > >>> this in git. I assume it is simple, but I get confused when I search for > >>> "git equivalent for svn update" and every single search result tells me > >>> something different, and none of them are trying to do the uber-simple > >>> case that I care about anyway. > >>> > >>> 2) Committing my local changes back to a remote server. This is what I > >>> would want to do if I was working on the ohrrpgce using git. I know I > >>> that local branches are a big deal with git, and that disconnected > >>> operation without an internet connection is a big deal with git, but for > >>> my purposes I want to treat a centralized repsitory on a server as the > >>> master, and use it to sync any assorted workstations I might happen to > >>> be sitting in front of at the moment. > >>> > >>> --- > >>> James, Curious > >>> _______________________________________________ > >>> Ohrrpgce mailing list > >>> [email protected] > >>> http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org > > > > > > > > -- > > Mike Caron > > Tale of the Cave > > http://taleotc.com > > _______________________________________________ > > Ohrrpgce mailing list > > [email protected] > > http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org > _______________________________________________ > Ohrrpgce mailing list > [email protected] > http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org > _______________________________________________ Ohrrpgce mailing list [email protected] http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org
