branch

Git常用命令操作

人盡茶涼 提交于 2019-12-29 09:29:09
一、常用命令 1、git push origin :molly/dev 删远程分支 git branch -r -d origin/molly/dev 删除本地对远程分支的track git branch --set-upstream-to=origin/<branch> <branch> //建立本地分支对远程分支的追踪 git branch -vv查看分支与远程分支追踪状态 2、git remote prune origin 更新远程分支本地track 3、git log --pretty=oneline log信息看着杂乱,可以配置单行显示 4、git reflog 查看版本足迹 5、git rm --cached [file] 移除文件,只从暂存区移除; git rm --cached * 删除所有追踪 6、git rm [file] 移除文件,工作区和暂存区都移除 7、git stash 暂存修改 git stash pop 恢复暂存并删除 git stash apply 恢复暂存 git stash drop 丢弃暂存 git stash list 查看所有暂存状态 git stash apply stash@{0} 恢复指定暂存 8、.gitignore git add -f App.class 强制添加被ignore忽略的文件 git check-ignore -v

git - 的基本命令

♀尐吖头ヾ 提交于 2019-12-29 09:28:22
下面介绍git命令的作用 git init 初始化仓库 git clone [You can clone with HTTPS,SSH] 代码从服务器clone到本地,地址一般使用ssh地址 就是你配置的在        如果在clone的时候发生失败出现error, 这里不好重现, 原因你安装了多个xcode导致的需要在选择一个xcode版本, 大退就好了 git status 查看文件状态, 一般也是在修改完文件之后做的操作,还有就是add .之后查看还有没有文件add 进本地暂存区内,如果不存在标注红色文件,说明所有修改的文件都再暂存区内,因为commit的时候会将暂存区内的东西提交到本地git中,没有add的文件就不会提交进git git status -s 将结果以简短的形式输出 git branch -a 查看所有的分支,包括远程分支 git branch 显示当前所在的分支 git branch branchname 创建新的分支branchname, 注意:分支名一般概括功能内容,最好用一个标志开头,比如功能id:12305_addNavController git branch -m branch_0.1 branch_1.0 将本地branch_0.1重命名为branch_1.0 git branch -d/D 分支名 删除名称为branchname的分支

git 基本命令

爷,独闯天下 提交于 2019-12-29 09:28:09
1.设置ignore的文件和文件夹: 先进行全局设置:git config --global core.excludesfile ~/.gitignore 再在根目录下添加名为“.gitignore"的文件 在该文件中,添加需要ignore的文件名或文件夹,如: a.txt .\testignore\ .\b\bin\ 这样就排除了a.txt,testignore文件夹,b\bin文件夹这三个。 这篇文章记录我在使用git的过程中碰到远程分支和tag的相关内容,提纲: 查看远程分支 删除远程分支和tag 删除不存在对应远程分支的本地分支 重命名远程分支 把本地tag推送到远程 获取远程tag 查看远程分支 加上-a参数可以查看远程分支,远程分支会用红色表示出来(如果你开了颜色支持的话): ? View Code BASH 1 2 3 4 5 6 7 8 9 10 # git branch -a master remote tungway v1.52 * zrong remotes/origin/master remotes/origin/tungway remotes/origin/v1.52 remotes/origin/zrong 删除远程分支和tag 在Git v1.7.0 之后,可以使用这种语法删除远程分支: ? View Code BASH 1 git push

In git, how can I find the revision at which a branch was created?

时光毁灭记忆、已成空白 提交于 2019-12-29 04:14:52
问题 UPDATE: example repository, https://github.com/so-gitdemo/so-gitdemorepo In the context of the github repo. How can I easily locate rev "b0430cee"? I know I can just look, but the real example that this repository mimics has a dozen committers and multiple other branches. Not quite as easy to use inspection. How can I find the branch creation revision when the branch has been merged multiple times? I am aware of this question: How to determine when a Git branch was created? The solution does

Rebasing remote branches in Git

房东的猫 提交于 2019-12-29 02:23:09
问题 I am using an intermediate Git repository to mirror a remote SVN repository, from which people can clone and work on. The intermediate repository has it's master branch rebased nightly from the upstream SVN, and we are working on feature branches. For example: remote: master local: master feature I can successfully push my feature branch back to the remote, and end up with what I expect: remote: master feature local: master feature I then re-setup the branch to track the remote: remote:

Can I unshelve to a different branch in tfs 2008?

心已入冬 提交于 2019-12-29 02:19:12
问题 Let's assume that some developer in my team shelved his changes that he did in branch A. And I am working on branch B. Can I unshelve his changes into branch B? (By GUI or command prompt) 回答1: The Visual Studio Power Tools should let you do this. C:\src\2\Merlin\Main>tfpt unshelve /? tfpt unshelve - Unshelve into workspace with pending changes Allows a shelveset to be unshelved into a workspace with pending changes. Merges content between local and shelved changes. Allows migration of shelved

Can I unshelve to a different branch in tfs 2008?

懵懂的女人 提交于 2019-12-29 02:19:06
问题 Let's assume that some developer in my team shelved his changes that he did in branch A. And I am working on branch B. Can I unshelve his changes into branch B? (By GUI or command prompt) 回答1: The Visual Studio Power Tools should let you do this. C:\src\2\Merlin\Main>tfpt unshelve /? tfpt unshelve - Unshelve into workspace with pending changes Allows a shelveset to be unshelved into a workspace with pending changes. Merges content between local and shelved changes. Allows migration of shelved

如何查看哪些Git分支正在跟踪哪个远程/上游分支?

℡╲_俬逩灬. 提交于 2019-12-28 18:06:14
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 我知道我可以做 git branch --all ,这向我展示了本地和远程分支,但它在向我展示它们之间的关系方面没有用。 如何以显示哪个本地分支正在跟踪哪个远程的方式列出分支? #1楼 我用这个别名 git config --global alias.track '!f() { ([ $# -eq 2 ] && ( echo "Setting tracking for branch " $1 " -> " $2;git branch --set-upstream $1 $2; ) || ( git for-each-ref --format="local: %(refname:short) <--sync--> remote: %(upstream:short)" refs/heads && echo --Remotes && git remote -v)); }; f' 然后 git track #2楼 基于 Olivier Refalo的回答 if [ $# -eq 2 ] then echo "Setting tracking for branch " $1 " -> " $2 git branch --set-upstream $1 $2 else echo "-- Local --" git for

git fetch vs. git fetch origin master have different effects on tracking branch

不羁岁月 提交于 2019-12-28 04:53:11
问题 This is mostly of the nature of a curiosity as I'm trying to get familiar with Git. I have looked at the documentation for 'git fetch' but I don't see an obvious explanation for the below. Thanks in advance, and apologies if this is howlingly obvious. 1) From a central repository, say GitHub, I clone a repository named website on each of two machines, HostA and HostB . 2) on HostA , I make a change to a file, say README.txt , and commit it. At this point on HostA , the commits for branches

Git Merge and Fixing Mixed Spaces and Tabs with two Branches

走远了吗. 提交于 2019-12-28 03:25:06
问题 I've gone through some similar SOQ's and have not seen an adequate solution for this case. I've noticed that in many files there is a dirty mix of tabs and spaces used for indenting. The coding standard we follow uses 4 spaces for a tab currently. Although this should have been addressed when it happened, I need to consider it now and would like to fix the files I come across. The issue is that there are two teams using different branches of code and we will eventually have to merge those