User Tools

Site Tools


Sidebar

Dan's Wiki

DokuWiki Instructions (local) DokuWiki Manual
Site Checker (Orphans Wanted)

Edit Sidebar

raspberrypi:gitinfo

This is an old revision of the document!


Git Notes

YouTube Videos

Command Line Client

  • git config --global user.email “youremail@somewhere.com”
    • Sets up email to be used each time pushing/committing
  • git config --global user.name “yourusername”
    • Sets up the user name to be used each time pushing/committing, so it won't be prompted every time.
  • git init
    • Be inside of a directory that you want to set up as a local Git repository. Creates a *.git* directory with information in it
  • git status
    • lists any files that are changed/not included in local Git repository
  • git add
    • Adds files to local Git repository. By name or wild card
  • git commit -m “some message”
    • Commits file changes to local Git repository. Adds revision message.
  • git remote add origin ssh://git@stopstogo.com/home/git/repo.git
    • Adds a remote Git repository to current local Git repository
  • git push -u origin master
    • Pushes files from “master” branch of local Git repository to remote repository
  • git log
  • git –help

How to create new branch

  • git branch “branch name” - Create new branch in local repository
  • git checkout “branch name” - Local content becomes this branch

How to merge branch back to "master

  • First checkout “master”, then git merge “branch name”
  • git push -u origin “master” - push merged content to remote
  • No longer need the branch, so we delete it
  • git branch -d “branch name”
  • Delete from remote also
    • git push origin –delete “branch name”

Git TAGs

Tagging in Git refers to creating specific points in history for your repository/data.

  1. To Mark release points for your code/data (stable release point)
  2. To create historic restore points
  • Checkout the branch where you want to create the tag
    • git checkout “branch name”
  • Create tag with some name
    • git tag “Version 1.0” - Lightweight tag
    • git tag -a “v1.1” -m “tag for release version 1.1” - Stored as complete object
    • git show v1.0
    • git tag -l “v1.*”
  • Push tags to remote
    • GitHub shows “releases” for tags“
    • git push origin v1.0
    • git push –tags - push all tags
    • git tag –delete v1.0
    • git push origin -d v1.0 - delete this tag from remote
  • Checkout tags in git
    • We cannot checkout tags in git
    • We can create a branch from a tag and checkout the branch
    • git checkout -b “branch name” “tag name”
  • Create a tag from some past commit
    • git tag “tag name” “reference of commit” - the checksum or just a part of it.
    • git push –tags - pushes all tags to remote repository

Add Github project to eclipse

https://www.youtube.com/watch?v=LPT7v69guVY

  • Goto Perspective → Git Respositories and click on “Get Repositories”
  • Supply URL to remote and accept defaults
  • Create project in Eclipse.
  • Right click the project, Team → Share Project → (Add to git repository)
  • Select repository that was used.
  • Find files mentioned in “Unstaged Changes”, drag to “Staged Changes”
  • Type message in “Commit Message”
  • Click “Commit and Push” to send the project to the repo
raspberrypi/gitinfo.1518627725.txt.gz · Last modified: 2018/02/14 17:02 by dwheele