Skip to content
win edited this page Mar 1, 2020 · 13 revisions

note: from source folder of HTML-Renderer

  1. to push source from one local repo to remote repo

    git push [email protected]:prepare/LayoutFarm +v1.7:master

  2. to delete previous push

    git push [email protected]:prepare/LayoutFarm +first_7_digit_of_commit_id^:master

  3. to branch from specific commit

    git checkout -b new_branch_name specific_commit_id

  4. to disable fast forward merge

    git config --global merge.ff false

  5. To delete a local branch

    git branch -d the_local_branch


from http://nvie.com/posts/a-successful-git-branching-model/

Incorporating a finished feature on develop

Finished features may be merged into the develop branch definitely add them to the upcoming release:

Switched to branch 'develop'

 $ git checkout develop

merge,left 'tracking history' behind, (not 'plain' merge)

 $ git merge --no-ff myfeature

delete merged branch

 $ git branch -d myfeature

push

 $ git push origin develop

from http://stackoverflow.com/questions/9589814/how-do-i-force-git-pull-to-overwrite-everything-on-every-pull

Force sync with server

  git fetch origin master
  git reset --hard $FETCH_HEAD
  git clean -df

where 'master' is a branch name you want to sync


force clone specific commit

  git clone  $URL
  cd  $PROJECT_NAME
  git reset --hard  $SHA1

from http://stackoverflow.com/questions/4674226/does-github-keep-deleted-remote-branches-in-history-if-so-can-those-be-restore

Yes, it's possible to restore a deleted branch from git. Find your Commit ID: Search for a branch using git reflog

If you had the branch in your local git repo within the last 30 days, you may be able to find it in the reflog using the following:

 git reflog

Search for the branch name in the reflog and note the HEAD{x} point or the commit ID. Re-create the branch from the Reflog HEAD point:

 git checkout -b branch_name HEAD@{27}

Re-create the branch from the commit ID: Method 1

You can checkout the commit ID and create a branch off of that commit point:

 git checkout -b branch_name <commit id>

Re-create the branch from the commit ID: Method 2

 git branch <commit id>

Set Proxy

http://stackoverflow.com/questions/783811/getting-git-to-work-with-a-proxy-server

771 down vote accepted

Command to use:

git config --global http.proxy http://proxyuser:[email protected]:8080

change proxyuser to your proxy user
change proxypwd to your proxy password
change proxy.server.com to the URL of your proxy server
change 8080 to the proxy port configured on your proxy server

If you decide at any time to reset this proxy and work without proxy:

Command to use:

 git config --global --unset http.proxy

Finally, to check the currently set proxy:

 git config --global --get http.proxy

ubutu 14.04 , add keyserver behide proxy, add --keyserver-options http-proxy= eg...

sudo apt-key adv --keyserver-options http-proxy= --keyserver ...


submodule

see https://github.com/blog/2104-working-with-submodules

git-clone-from-another-directory

from https://stackoverflow.com/questions/21045061/git-clone-from-another-directory

 cd /d c:\
 git clone C:\folder1 folder2

 From the documentation for git clone:

For local repositories, also supported by git natively, the following syntaxes may be used:

/path/to/repo.git/

file:///path/to/repo.git/

These two syntaxes are mostly equivalent, except the former implies --local option.

Cmake on mac :

CMake error no CMAKE_C_COMPILER could be found using Xcode and GLFW

see=> https://stackoverflow.com/questions/41380900/cmake-error-no-cmake-c-compiler-could-be-found-using-xcode-and-glfw/41420653

Did you install Xcode and Xcode Commandline Tools?

xcode-select --install

If you have Xcode Commandline Tools installed, you should no longer be receiving the xcrun is missing error.

How did you install Cmake? Once you have ensured that Xcode Commandline Tools is installed, please completely remove Cmake from your system and reinstall it. You have a screwed up configuration. There are ways to debug and fix it without a clean install, but since you are new to this, it will be the easiest and lest frustrating way.

Failing that if you do have Xcode Commandline Tools installed, hstdt suggested trying this:

sudo xcode-select --reset

--

from https://teamtreehouse.com/community/git-commit-a-m-new-message-commits-all-changes-so-what-happens-when-i-just-type-git-commit-m-new-message

git add -A

git commit -m "some message"


Update a submodule to the latest commit

(https://stackoverflow.com/questions/8191299/update-a-submodule-to-the-latest-commit)

git submodule update --remote --merge

Clone this wiki locally