git log --stat --decorate 显示信息更多 HEAD, tag: 313654, origin/master, origin/HEAD, master) charlie.chen@zhsa01:~/work/bdrt_test/output/build/aliboot-BL3.2.2-20170518F$ git log --stat --decorate commit 575e3c2ef195d4d46b403c86de89ff01854d256d (HEAD, tag: BL3.2.2-20170518F, origin/3.2, branch_BL3.2.2-20170518F) Author: charlie.chen <charlie.chen@alitech.com> Date: Thu May 18 17:49:09 2017 +0800 Fixed no logo but should compile DE for r4 3505 retailer src/app/loader/loader_r4/compiler.def | 4 ++++ 1 file changed, 4 insertions(+) 【git仓库,提交代码的时候忽略修改文件权限带来的变化】 #git config core.filemode false #git status -uno vim .git/config 上面2条,有时候一条就可以了。 发现文件是因为权限的改变而导致我需要提交文件。感觉这种东西特别麻烦。对我来说不需要。不知要git为什么要把这个文件权限也放到了版本管理中。很奇怪。 但是总是会有办法的, 我们可以使用如下方法让git忽略文件权限,执行以下命令 git config core.filemode false vim .git/config 1 [core] 2 repositoryformatversion = 0 3 filemode = false <================================== 4 bare = false 5 logallrefupdates = true 6 [remote "origin"] 7 fetch = +refs/heads/*:refs/remotes/origin/* */ 8 url = git@zhsa01:stu-pdk/aliboot-p4.git 9 [branch "master"] 10 remote = origin 11 merge = refs/heads/master ##################################### 【git blame 查看代码某一行】 charlie.chen@zhsa01:~/work/xxx/buildroot/output/build/uboot-BL3.1.2-20170410$ git blame ./common/board_r.c -L 110,134 fd05b4c8 (terry.wu 2016-03-29 11:13:40 +0800 110) unsigned long flash_init_nor_probe(void) fd05b4c8 (terry.wu 2016-03-29 11:13:40 +0800 111) { fd05b4c8 (terry.wu 2016-03-29 11:13:40 +0800 112) unsigned int bus = CONFIG_SF_DEFAULT_BUS; fd05b4c8 (terry.wu 2016-03-29 11:13:40 +0800 113) unsigned int cs = CONFIG_SF_DEFAULT_CS; fd05b4c8 (terry.wu 2016-03-29 11:13:40 +0800 114) unsigned int speed = CONFIG_SF_DEFAULT_SPEED; fd05b4c8 (terry.wu 2016-03-29 11:13:40 +0800 115) unsigned int mode = CONFIG_SF_DEFAULT_MODE; fd05b4c8 (terry.wu 2016-03-29 11:13:40 +0800 116) struct spi_flash *new; fd05b4c8 (terry.wu 2016-03-29 11:13:40 +0800 117) fd05b4c8 (terry.wu 2016-03-29 11:13:40 +0800 118) new = spi_flash_probe(bus, cs, speed, mode); fd05b4c8 (terry.wu 2016-03-29 11:13:40 +0800 119) if (!new) fd05b4c8 (terry.wu 2016-03-29 11:13:40 +0800 120) { fd05b4c8 (terry.wu 2016-03-29 11:13:40 +0800 121) printf("Failed to initialize SPI flash at %u:%u\n", bus, cs); fd05b4c8 (terry.wu 2016-03-29 11:13:40 +0800 122) return 1; fd05b4c8 (terry.wu 2016-03-29 11:13:40 +0800 123) } fd05b4c8 (terry.wu 2016-03-29 11:13:40 +0800 124) fd05b4c8 (terry.wu 2016-03-29 11:13:40 +0800 125) if (flash) fd05b4c8 (terry.wu 2016-03-29 11:13:40 +0800 126) { fd05b4c8 (terry.wu 2016-03-29 11:13:40 +0800 127) spi_flash_free(flash); fd05b4c8 (terry.wu 2016-03-29 11:13:40 +0800 128) } fd05b4c8 (terry.wu 2016-03-29 11:13:40 +0800 129) flash = new; fd05b4c8 (terry.wu 2016-03-29 11:13:40 +0800 130) fd05b4c8 (terry.wu 2016-03-29 11:13:40 +0800 131) return 0; fd05b4c8 (terry.wu 2016-03-29 11:13:40 +0800 132) } fd05b4c8 (terry.wu 2016-03-29 11:13:40 +0800 133) #endif fd05b4c8 (terry.wu 2016-03-29 11:13:40 +0800 134) charlie.chen@zhsa01:~/work/xxx/buildroot/output/build/uboot-BL3.1.2-20170410$ 【scp 相互拷贝】 服务器-->本地 scp burning_log andy@10.8.5.23:/home/andy/charlie 本地-->服务器 scp -r ./momofile charlie.chen@192.168.9.201:zhsa012/usrhome/charlie.chen/work/my_test scp -r ./momofile charlie.chen@10.8.1.171:zhsa112/usrhome/charlie.chen/work/ su charlie.chen 1. 本地分支重命名 Git branch -m oldbranchname newbranchname 2. 远程分支重命名 (假设本地分支和远程对应分支名称相同) a. 重命名远程分支对应的本地分支 git branch -m old-local-branch-name new-local-branch-name b. 删除远程分支 git push origin :old-local-branch-name c. 上传新命名的本地分支 git push origin new-local-branch-name: new-local-branch-name git add . git commit -a -m "xxx" //小心 -s签名 git push origin master git show bdb4b4684088a5fca77fce5f045de0908b072a83 --stat //查看哪些文件被提交 aliboot git仓库: git clone git@zhsa01:stu-pdk/aliboot.git git status -uno Y:\work\bdrt_test\boot\bl-postbuild\bl-postbuild-C3505 bl-postbuild-C3505.mk ###############在git服务器上新建仓库############ git init --bare test.git charlie.chen@zhsa01:~$ charlie.chen@zhsa01:~$ su git Password: git@zhsa01:/zhsa012/usrhome/charlie.chen$ cd git@zhsa01:~$ cd ibu-sdk/ git@zhsa01:~/ibu-sdk$ exit exit charlie.chen@zhsa01:~$ 新建好仓库后, 1.clone到本地,添加自己的代码 2.上传git push origin master 添加 邮箱和名字 才能 git commit git push git config --global user.name "Firstname Lastname" git config --global user.email "your_email@youremail.com" ############################################### 用"git init"初始化的版本库用户也可以在该目录下执行所有git方面的操作。但别的用户在将更新push上来的时候容易出现冲突。 比如有用户在该目录(就称为远端仓库)下执行git操作,且有两个分支(master 和 b1),当前在master分支下。 另一个用户想把自己在本地仓库(就称为本地仓库)的master分支的更新提交到远端仓库的master分支,他就想当然的敲了 git push origin master:master 于是乎出现 因为远端仓库的用户正在master的分支上操作,而你又要把更新提交到这个master分支上,当然就出错了。 但如果是往远端仓库中空闲的分支上提交还是可以的,比如 git push origin master:b1 还是可以成功的 解决办法就是使用”git init –bare”方法创建一个所谓的裸仓库,之所以叫裸仓库是因为这个仓库只保存git历史提交的版本信息, 而不允许用户在上面进行各种git操作,如果你硬要操作的话,只会得到下面的错误(”This operation must be run in a work tree”) 这个就是最好把远端仓库初始化成bare仓库的原因。 ####################个人创建git repo begin############################### charlie.chen@zhsa01:~/work/my_test/gitrepo/test.git$ git init Initialized empty Git repository in /zhsa012/usrhome/charlie.chen/work/my_test/gitrepo/test.git/.git/ charlie.chen@zhsa01:~/work/my_test/gitrepo/test.git$ charlie.chen@zhsa01:~/work/my_test/gitrepo/test.git$ echo "hello,git" > sayhi.txt charlie.chen@zhsa01:~/work/my_test/gitrepo/test.git$ charlie.chen@zhsa01:~/work/my_test/gitrepo/test.git$ charlie.chen@zhsa01:~/work/my_test/gitrepo/test.git$ ls sayhi.txt charlie.chen@zhsa01:~/work/my_test/gitrepo/test.git$ ll total 16 drwxrwxr-x 3 charlie.chen charlie.chen 4096 Mar 8 17:25 ./ drwxrwxr-x 3 charlie.chen charlie.chen 4096 Mar 8 17:25 ../ drwxrwxr-x 7 charlie.chen charlie.chen 4096 Mar 8 17:25 .git/ -rw-rw-r-- 1 charlie.chen charlie.chen 10 Mar 8 17:25 sayhi.txt charlie.chen@zhsa01:~/work/my_test/gitrepo/test.git$ cd .git/ charlie.chen@zhsa01:~/work/my_test/gitrepo/test.git/.git$ ls branches config description HEAD hooks info objects refs charlie.chen@zhsa01:~/work/my_test/gitrepo/test.git/.git$ cd .. charlie.chen@zhsa01:~/work/my_test/gitrepo/test.git$ ls sayhi.txt charlie.chen@zhsa01:~/work/my_test/gitrepo/test.git$ git add . charlie.chen@zhsa01:~/work/my_test/gitrepo/test.git$ charlie.chen@zhsa01:~/work/my_test/gitrepo/test.git$ charlie.chen@zhsa01:~/work/my_test/gitrepo/test.git$ git branch charlie.chen@zhsa01:~/work/my_test/gitrepo/test.git$ charlie.chen@zhsa01:~/work/my_test/gitrepo/test.git$ charlie.chen@zhsa01:~/work/my_test/gitrepo/test.git$ git status # On branch master # # Initial commit # # Changes to be committed: # (use "git rm --cached <file>..." to unstage) # # new file: sayhi.txt # charlie.chen@zhsa01:~/work/my_test/gitrepo/test.git$ git commit -m "First file for test" [master (root-commit) 762a288] First file for test 1 file changed, 1 insertion(+) create mode 100644 sayhi.txt charlie.chen@zhsa01:~/work/my_test/gitrepo/test.git$ charlie.chen@zhsa01:~/work/my_test/gitrepo/test.git$ charlie.chen@zhsa01:~/work/my_test/gitrepo/test.git$ git status # On branch master nothing to commit (working directory clean) charlie.chen@zhsa01:~/work/my_test/gitrepo/test.git$ git branch * master charlie.chen@zhsa01:~/work/my_test/gitrepo/test.git$ charlie.chen@zhsa01:~/work/my_test/gitrepo/test.git$ git remote -v charlie.chen@zhsa01:~/work/my_test/gitrepo/test.git$ charlie.chen@zhsa01:~/work/my_test/gitrepo/test.git$ charlie.chen@zhsa01:~/work/my_test/gitrepo/test.git$ git push origin master fatal: 'origin' does not appear to be a git repository fatal: The remote end hung up unexpectedly charlie.chen@zhsa01:~/work/my_test/gitrepo/test.git$ charlie.chen@zhsa01:~/work/my_test/gitrepo/test.git$ charlie.chen@zhsa01:~/work/my_test/gitrepo/test.git$ charlie.chen@zhsa01:~/work/my_test/gitrepo/test.git$ git remote add charlie.chen@zhsa01:work/my_test/gitrepo/test.git usage: git remote add [<options>] <name> <url> -f, --fetch fetch the remote branches --tags import all tags and associated objects when fetching or do not fetch any tag at all (--no-tags) -t, --track <branch> branch(es) to track -m, --master <branch> master branch --mirror[=<push|fetch>] set up remote as a mirror to push to or fetch from charlie.chen@zhsa01:~/work/my_test/gitrepo/test.git$ git remote add origin charlie.chen@zhsa01:work/my_test/gitrepo/test.git charlie.chen@zhsa01:~/work/my_test/gitrepo/test.git$ charlie.chen@zhsa01:~/work/my_test/gitrepo/test.git$ charlie.chen@zhsa01:~/work/my_test/gitrepo/test.git$ git remote -v origin charlie.chen@zhsa01:work/my_test/gitrepo/test.git (fetch) origin charlie.chen@zhsa01:work/my_test/gitrepo/test.git (push) charlie.chen@zhsa01:~/work/my_test/gitrepo/test.git$ git status # On branch master nothing to commit (working directory clean) charlie.chen@zhsa01:~/work/my_test/gitrepo/test.git$ git branch * master charlie.chen@zhsa01:~/work/my_test/gitrepo/test.git$ git push origin master charlie.chen@zhsa01's password: Everything up-to-date charlie.chen@zhsa01:~/work/my_test/gitrepo/test.git$ git log commit 762a2884d045b53b3bec8c8addfa2799066ab3f1 Author: charlie.chen <charlie.chen@alitech.com> Date: Wed Mar 8 17:26:30 2017 +0800 First file for test charlie.chen@zhsa01:~/work/my_test/gitrepo/test.git$ 下载测试 charlie.chen@zhsa01:~/work/my_test/work$ git clone charlie.chen@zhsa01:work/my_test/gitrepo/test.git Cloning into 'test'... charlie.chen@zhsa01's password: remote: Counting objects: 3, done. remote: Total 3 (delta 0), reused 0 (delta 0) Receiving objects: 100% (3/3), done. charlie.chen@zhsa01:~/work/my_test/work$ ls test charlie.chen@zhsa01:~/work/my_test/work$ cd test/ charlie.chen@zhsa01:~/work/my_test/work/test$ ls sayhi.txt charlie.chen@zhsa01:~/work/my_test/work/test$ vim sayhi.txt ########## git clone charlie.chen@zhsa01:work/my_test/gitrepo/test.git ####################个人创建git repo end############################### uboot git仓库: git clone git@zhsa01:stu-pdk/u-boot-ali.git printf("\n====>%s line %d ====>load environment from nand flash....\n", __FUNCTION__, __LINE__); printf("\n====>%s line %d ====>load environment from nand flash....\n", __FUNCTION__, __LINE__); printf("\n====>%s line %d ====>load environment from nand flash....\n", __FUNCTION__, __LINE__); printf("\n====>%s line %d ====>load environment from nand flash....\n", __FUNCTION__, __LINE__); @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ #########make show-lastdefconfig show-source show-targets show-version help: @echo 'Cleaning:' @echo ' clean - delete all files created by build' @echo ' distclean - delete all non-source files (including .config)' @echo @echo 'Build:' @echo ' all - make world' ifneq ($(BR2_ENVIRONMENT_CUSTOMER),y) @echo ' ali-release - release ALi packages and patches' @echo ' ali-clean-release - clean released ALi packages and patches' @echo ' <package>-release - release <package> and patches of <package>' @echo ' <package>-clean-release - clean released <package> and patches of <package>' endif @echo ' toolchain - build toolchain' @echo ' <package>-rebuild - force recompile <package>' @echo ' <package>-reconfigure - force reconfigure <package>' @echo ' <package>-graph-depends - generate graph of the dependency tree for package' @echo ' <package>-show-version - show version of <package>' @echo ' show-version - show version of target packages' @echo ' show-lastdefconfig - show last defconfig' @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ |
|
来自: charlie_linux > 《git》