Git - axxia/axxia_yocto_linux_4.9 GitHub Wiki

Git Notes

There are many was to do any of the followoing. This is just one way.

General git knowledge is widely available. If you've never used it, read an overview!

Proxy Setup for LSI

IT won't allow, at least generally, access to remote git repositories. The following works at present.

Environment

export proxy="http://135.156.228.210:9400"
export http_proxy=$proxy
export https_proxy=$proxy
export ftp_proxy=$proxy
export no_proxy=lsi.com
export GIT_PROXY_COMMAND=/home/jjacques/scripts/git_proxy_command.sh

git_proxy_command.sh may take some explaination. It is a wrapper for the "connect" command (/workspace/sw/jjacques/apps/src/connect). Make a copy of the source, and build connect. I may change things at any time, and without notice.

.ssh/config

Host github.com
     ProxyCommand corkscrew 135.156.228.210 9400 %h %p

Create a Repository

<Create an Empty Repository in github, Using the Web Interface>

<Clone Locally (Linux or U-Boot for example)>

For U-Boot, use git://git.denx.de/u-boot.git

For Linux, use git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git or one of the Yocto repos, git://git.yoctoproject.org/linux-yocto-3.8 for example. In that clone, do the following.

$ git remote rm origin
$ git remote add origin <github repo>
$ git config master.remote origin
$ git config master.merge refs/heads/master
$ git push origin master
$ git push --tags origin master

Switch origin to https

$ git config remote.origin.url <https url>

Add the original repo as upstream

$ git remote add upstream <same as the repo cloned above>

To get the latest changes from upstream

$ git fetch upstream
$ git merge upstream/master

Clone a Repository

$ git clone [email protected]:lsigithub/lsi_axxia_linux.git

Get a Remote Branch and Turn on Tracking

$ git checkout --track -b <local branch name> origin/<remote branch name>

Switch to an Existing Branch

$ git checkout <local branch name>

List Local Branches

$ git branch

List all Branches

$ git branch -a

Create a Patch

$ git format-patch master --stdout ><patch>

OR

$ git diff master >../<patch file>

Create a Remote Branch

$ git checkout <the branch you want to branch from>
$ git branch <new branch>
$ git push origin <new branch>
$ git branch --set-upstream <new branch> origin/<new branch>

Checking in Changes

$ git add <files to commit>
$ git commit

Update a Remote Branch

$ git push

Reverting All Uncommited Changes

$ git reset --hard
$ git clean -fdx

Deleting a branch

$ git branch -d <the local branch name>
$ git push origin :<the remote branch name>

Renaming a Branch

$ git branch -m old-branch-name new-branch-name
$ git push origin :old-branch-name
$ git push -u origin new-branch-name

Tagging

$ git tag -a <tag name> -m <tag description>

Delete a Tag (Local and Remote)

$ git tag -d <tag name>
$ git push origin :refs/tags/<tag name>

Merging commits

$ git rebase -i HEAD~N (where N is the number of commits to merge)
<follow the directions...>
$ git commit --amend (to change the final comments)
$ git rebase --continue (to finish)

Push to public...

<Set up "public" as a Remote>
$ git checkout master
$ git push public <branch>
$ git push public --tags

Merging Safely

<Make sure you're where you want to be if things go wrong...>
$ git branch <a new branch>
$ git merge <the branch you want to merge changes from>

If the merge went well,

$ git branch -d <a new branch>

If not,

$ git reset --hard <a new branch>

Document Version

$Revision: 1.1 $
$Date: 2014/03/18 17:01:03 $
⚠️ **GitHub.com Fallback** ⚠️