Git

Is being followed by 0 users

There are 186 cards with this tag.

There are 1 decks with cards that have this tag.

Created by: Jack Kinsella

git - how to remove files from your hard drive which are not currently tracked by git (e.g. you did a git reset --hard and there are files lying about which were supposed to be removed)

git clean -f

# you must use the -f option for it to actually delete the files
# before using always run a git clean -n to dry run and see a list of what the -f command would do

Created by: Jack Kinsella

git - what does this do with no args:

git reset

defaults to git reset HEAD

stage gets reset to contents of the last commit

Created by: Jack Kinsella

How to create a new branch (newfeature) in git?

git checkout -b newfeature

Created by: Jack Kinsella

where does git store its config files

.git/config

Created by: Jack Kinsella

git - what does this do during a merge:

git show :3:db/schema.rb

shows their version of the file

# :2 is ours
# :1 is common ancestor

Created by: Jack Kinsella

git - distinguish between what happens in both of these scenarios:

git reset B
git checkout B

# history:
- A -B -C (HEAD, master)

reset
-A-B (HEAD, master)
# takes current branch (master) and resets it to somewhere else

checkout
-A-B(HEAD) - C (master)
# head, working tree and index all at B, but branch at C (detached head)

Created by: Jack Kinsella

git - see what things looked like 10 minutes ago

git diff @{10.minutes.ago}

Created by: Jack Kinsella

why does this fail?

git submodule add ../facebook_light_gem vendor/facebook_light_gem

git submodule add expects a remote repository (i.e. one with a url defined in .git/config)

Created by: Jack Kinsella

git - best way to view status

git status --short

# displays a sidebar MM (red/green) filename which is great for fixing merge conflicts

Created by: Jack Kinsella

What happens when you go back to an older commit using git checkout 14352a ?

You are left on a "detached head" - detaches your HEAD from the current branch and directly points at the commit 14352a

Created by: Jack Kinsella

!something
in a gitignore file means what?

e.g.
!gems/cache

negates the pattern; any matching file excluded by a previous pattern will become included again.

Created by: Jack Kinsella

git - get a reference to one commit ago

HEAD^

  • There are 186 results.

You must be logged in to perform this action.

Login now

×

Deck Management

You must be logged in to perform this action.

Login now

Done ×

Deck Management

You must be logged in to perform this action.

Login now

Done ×

Deck Management

You must be logged in to perform this action.

Login now

Done ×

Deck Management

You must be logged in to perform this action.

Login now

Done ×

Deck Management

You must be logged in to perform this action.

Login now

Done ×

Deck Management

You must be logged in to perform this action.

Login now

Done ×

Deck Management

You must be logged in to perform this action.

Login now

Done ×

Deck Management

You must be logged in to perform this action.

Login now

Done ×

Deck Management

You must be logged in to perform this action.

Login now

Done ×

Deck Management

You must be logged in to perform this action.

Login now

Done ×

Deck Management

You must be logged in to perform this action.

Login now

Done ×

Deck Management

You must be logged in to perform this action.

Login now

Done ×