Thursday, August 14, 2014

Git reset soft/mixed/hard

What is the difference between git reset soft, mixed and hard? When doing reset in git, you can add --soft, --mixed or --hard switch, or leave it, --mixed is the default. What do this switches do?

  1. Code before changes
  2. Code after changes
  3. Changes staged on index
  4. Changes commited

Now if you issue

git reset --xxxx HEAD~1

--soft moves you back to (3), --mixed to (2) and --hard to (1)

Written with StackEdit.

3 comments:

  1. This comment has been removed by a blog administrator.

    ReplyDelete
  2. Hi, I was wondering can I use IntelliJ's database tool to connect to H2 without having to enter the console? I actually tried it and the connection was successful but I couldn't see any of the tables/records

    ReplyDelete
  3. It depends on what URL you use to connect to the DB. The url like `jdbc:h2:mem:custom_db_name` creates database in memory, and it is accessible only from within the process it is created in.

    Probably when you connected from IntelliJ's tool, you created a new database with the same name, but in a different process.

    ReplyDelete

Note: Only a member of this blog may post a comment.