Using git

Previous Topic Next Topic
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view

Using git

Civil Guy
I'm new to using git.  I think I'd like to use it locally with a Linux / Ubuntu command line.

I followed the instructions to clone LibreCAD to my laptop, then modified a couple files before I figured out that that was not the right way to go.  I'd like to revert those files to the master-branch version, then update my local files with the current updates to the master branch.

How can I do that?
Reply | Threaded
Open this post in threaded view

Re: Using git

If you haven't added the modification to the index yet, you can do a checkout to revert changes.

git status
to see if any files are added to commit.
Or use
git diff
If you see diffs, the modifications are not added to the index yet.
git diff --cached
you can also check if there are any files to be committed in the index.

So when the index is empty, there is no output with
git diff --cached
then use this:
git checkout master
git pull

When you have modifications in the index, you have to reset your repo this way:
git reset --hard
git pull
This will revert the modifications in the working tree and also reset the index.

You may also have a look at these resources:
git tutorial:
git reference: