Showing posts with label git. Show all posts
Showing posts with label git. Show all posts

Tuesday, March 28, 2017

git notes

Git tools on windows

  • Git for Windows (git bash as CLI)
  • SourceTree (GUI for git)

Start git bash in specific directory on windows

Modify git bash shortcut - under Target:
instead
D:\Tools\Git\git-bash.exe --cd-to-home
put
D:\Tools\Git\git-bash.exe --cd=D:\git

Git usage

Clone repository

$ git clone URL

Switch to tag/branch

$ git checkout tags/<tag_name>

List all tags

$ git tag -l

Remove local repository

delete directory :)

Revert changes

# Revert changes to modified files.
$ git reset --hard

# Remove all untracked files and directories. (`-f` is `force`, `-d` is `remove directories`)
$ git clean -fd

Git stash

-- Stash the changes in a dirty working directory away
--  saves your local modifications away and reverts the working directory to match the HEAD commit.
$ git stash apply -- restore stashed files - you need to call git stash drop to remove files from stash!

$ git stash pop -- move files from stash into branch

## https://stackoverflow.com/questions/11269256/how-to-name-and-retrieve-a-stash-by-name-in-git
$ git stash save "guacamole sauce WIP"
$ git stash apply stash^{/guacamo}
or git stash apply stash@{n}


How to see remote location

$ git remote show origin

Ref

Getting Started with Git @dzone
Tutorial 1: Using branch
Git from the inside out
A successful Git branching model By Vincent Driessen

Thursday, April 23, 2015

Moving project to git repository

I have git repo at bitbucket


  1. create repository on bitbucket via web UI
  2. go to project directory folder on your machine
  3. git init
  4. git remote add origin "URL to repo"
  5. eclipse (with egit plugin) - share project using git
  6. commit & push

Ref: