Date: Thu, 06 Apr 2017 04:22:12 +0000 From: "Thomas Mueller" <mueller6722@twc.com> To: freebsd-x11@freebsd.org Cc: Andreas Nilsson <andrnils@gmail.com>, Doug Kirk <dbkirk@gmail.com> Subject: Re: Switching branches of freebsd-base-graphics with git Message-ID: <8C.30.25473.F82C5E85@dnvrco-omsmta03> References: <E7.99.29375.6FD94E85@dnvrco-omsmta02> <CAPS9%2BSvcSdcALYgRyhdw2oqE93cPUb94pzYsP=BDQQadLXfzmg@mail.gmail.com> <CAGhTqAW7aRiFtiM9XrcXVehdoxEMkckLCu651XM9oP7OTRZ1BA@mail.gmail.com> <BF.3D.25473.18C75E85@dnvrco-omsmta03> <CAGhTqAWV=WkCuOzYk69-B763rVXuzxLMDQKcrV5uXncFqDyWRQ@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
from Doug Kirk: > I wouldn't `rm -R *`, that seems dangerous. :O > Try `git checkout drm-next` followed by `git pull origin drm-next`. The > latter command needs internet access while the former doesn't. (Because of > your fetch, one of those may complain...I can't remember. If so, `git reset > --hard` will get you back to the last-committed state of the current > branch, after which you can checkout and/or pull.) > `git clone $url [$name]`: > Copy the git *repository* at $url into a new subdirectory of the same > base-name [or $name]. You see the working tree; the repo is in its .git/ > subdirectory, including all branches and the entire version history. > `git checkout $branch`: > Make your working tree look like the committed state of $branch. > Usually to switch branches. A branch in git is just a type of "ref", and > you can check out any $ref. Other types are tags and revisions. > `git pull`: > `git fetch`, and then `git merge`, upstream changes into your current > working tree, and then commit those changes to your local repository if > there are no conflicts. (not technically 100% accurate, but the effect is > the same). > `git status`: > Show the current checked-out branch and the state of working tree > modifications. > `git fetch`: > Fetches new commits from a remote, but doesn't merge those into your > working tree or commit them to your current branch. > `git reset`: > If you've made uncommitted changes that you want to undo, this will > undo them. (see man page about --hard, --soft, and --mixed variants). > All the git commands have man pages, accessible either by `git help > {command}` or by `man git-{command}`. (e.g., either `man git-pull` or `git > help pull`) > Notes: > I don't know what the "remote" repo names (in your command `git fetch > remote`). With git-fetch (or pull), that is a repo name (which is just some > string you assign as a name for a repo, whether it's local or remote). > Usually we use "origin" there...which identifies the repo that yours was > cloned from unless you've edited the configuration. > A "remote" is "some other repository that's not the one in your current > project's .git/ subdirectory". Meaning that, even though it's called a > remote, it could just be another directory on the local filesystem (outside > your project dir). In `git pull origin drm-next`, the remote name is > "origin" as explained above, and "drm-next" is the *remote's* branch name > to fetch/merge into *your current branch*. > If you're not making changes, you really only need to know `git clone`, > `git checkout`, followed by periodic `git pull` to get the latest changes. > The `git reset` command has variants to reset the working tree and/or the > "index". The index is just the place where git stores to-be-committed > changes (usually a subset of the working tree changes). > Good luck with your taxes! > P.S., Per is correct, `git clone $url -b $branch` clones the entire > repository but checks out the named branch. Thanks for the help. I tried most of the git commands you show, but not reset. On that rm -R * I was in /freebsd-base-graphics so I couldn't lose anything outside. But, from root directory, rm -R /freebsd-base-graphics leaves room for a finger slip, like making an inadvertent space between / and freebsd-base-graphics. Now I see where I might need Midnight Commander or something like that. Git documentation helps but is not all clear. Keeping two source trees (regular and freebsd-base-graphics) and two ports trees (if I use freebsd-ports-graphics) imposes an extra load on my mind and my time, especially if I also track NetBSD (current only), Linux and try to cross-compile Haiku. I also think freebsd-base-graphics might be somewhat behind regular source tree on non-X ports, and freebsd-ports-graphics might be somewhat behind regular ports tree on non-X ports. Tom
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?8C.30.25473.F82C5E85>