Date: Thu, 06 Apr 2017 01:08:39 +0000 From: Doug Kirk <dbkirk@gmail.com> To: Thomas Mueller <mueller6722@twc.com>, freebsd-x11@freebsd.org Subject: Re: Switching branches of freebsd-base-graphics with git Message-ID: <CAGhTqAWV=WkCuOzYk69-B763rVXuzxLMDQKcrV5uXncFqDyWRQ@mail.gmail.com> In-Reply-To: <BF.3D.25473.18C75E85@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>
next in thread | previous in thread | raw e-mail | index | archive | help
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. On Wed, Apr 5, 2017 at 6:23 PM Thomas Mueller <mueller6722@twc.com> wrote: > from Doug Kirk: > > > `git pull` is just sugar for `git fetch` (fetch remote updates) then `git > > merge` (merge them into the current work tree). > > > Since git pulls down the entire repo (unlike svn), `git checkout $branch` > > is enough (AS LONG AS you originally cloned the entire repo instead of > just > > one branch -- `-b $branch` on the clone command). > > > So after the checkout as above, `git pull` should be enough to get the > > currently checked-out branch's updates from the remote repo. > > > Even if you didn't clone the entire repo, `git checkout $branch` followed > > by `git pull` is enough to checkout the branch and get its updates. > > > You can get a (local & remote) branch list with `git branch -a`. It'll > show > > a star for the current branch. > > > Also keep in mind that git won't do anything with non-tracked files, so > > you'll likely want to `make clean` to get rid of prior-branch remnants. > > I ran "git branch -a" on this computer and the other, showed branches, but > got more on this computer than the other: drm-next showed on this computer > but not the other. > > I ran "git fetch remote", thinking I would update the list of branches, > but got a bigger download. I am still in branch drm-i915-update-38 on that > computer. > > So I am lost at this stage, only way I can see is rm -R * from > /freebsd-base-graphics and start over with new branch. > > Now my head is spinning/swimming. I need to wait until after I finish my > income tax return. > > > Tom > >
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAGhTqAWV=WkCuOzYk69-B763rVXuzxLMDQKcrV5uXncFqDyWRQ>