git-branch

find out when a git branch was created (not the first commit to that branch)

坚强是说给别人听的谎言 提交于 2019-11-29 01:29:49
问题 how can I know when a git branch was created? i don't want to know when was the first commit to that branch. I want to find out when that branch was created. This is a script to reproduce a working example: #! /bin/bash set -x set -e mkdir test cd test git init echo "hello" >readme git add readme git commit -m "initial import" date sleep 5 git checkout -b br1 date # this is the date that I want to find out. sleep 5 echo "hello_br1" >readme git commit -a -m "hello_br1" date echo "hello_br1_b"

How to delete the old history after running git filter-branch?

蓝咒 提交于 2019-11-29 01:26:09
Suppose I have such tree: ... -- a -- b -- c -- d -- ... \ e -- a -- k and I want it become just ... -- a -- b -- c -- d -- ... I know how to attach branch name to "e". I know that what I'm going to do will change history, and this is bad. Also I guess I need to use something like rebase or filter-branch. But how exactly - I'm lost. Ok. Situation is following: I have rather big tree now (like this) s -- p -- r / a -- b -- c -- d -- e --- g -- w \ \ t -- p -- l y -- k but in my one of first commits (like to "b" for ex.) I added binary files, which makes whole repo very heavy. So I decided to

Merging one change to multiple branches in Git

*爱你&永不变心* 提交于 2019-11-28 22:41:50
I am used to having one main branch (master) and working in topic branches. But I'm working on a project now with two main branches (master and experimental) and I am unsure how to best merge my topic branch into both? Is this the right way to do it? If not can someone let me know the right way. (master)$ git checkout -b bugfix # do bug fix here (bugfix)$ git commit -a -m 'Fixed bug.' (bugfix)$ git checkout master (master)$ git merge bugfix (master)$ git checkout bugfix (bugfix)$ git rebase experimental (bugfix)$ git checkout experimental (experimental)$ git merge bugfix Thank you. Don't do

How to show git log with branch name

主宰稳场 提交于 2019-11-28 21:19:23
I try git log w/ --decorate and --source options. But still can not get the branch name of commit 2f3cb60 and d7e7776 , Why? #git log 2f3cb60 --graph --decorate --source --all --oneline ... * | | | 1920ad5 refs/heads/gpio support gpio lib | |/ / |/| | * | | 2f3cb60 2f3cb60 fix * | | d7e7776 2f3cb60 fix | |/ |/| * | aa4dcfb refs/remotes/origin/httpd support * | cfc839d refs/remotes/origin/httpd add folder How do I show git log with branch name? Jeff Bowman $ git log --graph --decorate --oneline * 1f3e836 (HEAD, origin/v2, v2) Change scripts to new format. * 34d458f (origin/master, master) Merge

GitHub: What is a “wip” branch?

烂漫一生 提交于 2019-11-28 20:42:30
问题 When I was browsing GitHub repositories I quite often saw "wip" branches (e.g. 3.1.0-wip ). What does "wip" mean? I couldn't find the answer anywhere - neither on Google nor on GitHub:help. 回答1: On GitHub, pull requests are prefixed by [WIP] to indicate that the pull requestor has not yet finished his work on the code (thus, w ork i n p rogress), but looks for have some initial feedback (early-pull strategy), and wants to use the continuous integration infrastructure of the project. For

Keep commits history after a 'git merge'

流过昼夜 提交于 2019-11-28 20:31:45
When I work on two different features (on two different branches created from the master ) it is quite annoying that I will not have the commit history when I proceed with merging. I'll explain better. When I finish work on Branch-A , I merge it into master . And that's fine, if I git log I see all the commits I made on Branch-A . Instead , when I finish work on Branch-B and I try to merge it to master (after that Branch-A has been already merged), I have to specify a commit message for the merging (while for the first branch I have not been asked anything). And after the merging to master ,

What is this branch tracking (if anything) in git?

霸气de小男生 提交于 2019-11-28 19:27:22
After creating a branch with --track (or leaving the default, or --notrack), you later wish to be reminded of what a branch is tracking. Is there a way, other than searching through the .git/config file, to display what a branch is tracking? Use: git branch -vv to see which branches are tracked and which are not. If you want to know for a given branch, you could do: git config --get branch.<branch>.remote If it prints a remote, it's tracking something. If it prints nothing and returns failure, it's not. Note that with git1.8.3 (April 22d, 2013) , you have a new way to emphasize the upstream

Configure a local branch for push to specific branch

*爱你&永不变心* 提交于 2019-11-28 18:52:39
Sorry if this question has been asked already. Am cloning from a repo named "git_lab" which has a branch named "test" When cloning i use "-b myname_test" to create a local branch named "myname_test" and local clone is named "myname_git_lab" When i do "git pull" it automatically fetches and merges changes from "test" to "myname_test", but for git push, i need to specify the repo and branch name. $>git remote show git_lab Local branch configured for 'git pull': myname_test merges with remote test Is there a way where i can configure "local branch configured for 'git push'" so that i dont need to

git merge squash and recurring conflicts

旧城冷巷雨未停 提交于 2019-11-28 18:48:03
I have a git repository with master and alt branches. alt branch contains modified version of master code, and i am trying to merge changes from master to alt like this: git merge --squash master Merge results in conflict: Auto-merging myproject/foo/bar CONFLICT (content): Merge conflict in myproject/foo/bar Squash commit -- not updating HEAD Automatic merge failed; fix conflicts and then commit the result. After I resolve conflicts and commit changes everything seems fine, but when i run git merge --squash master again (without doing any changes on any branches) i will get same conflict error

Can I add a message/note/comment when creating a new branch in Git?

孤街浪徒 提交于 2019-11-28 18:47:38
I'm doing some exploratory work where I will most likely be spending 30 min on several different variations of the same task. I want to track them in git so I can jump back and forth between approaches. And if there are 3 or 6 or 9 branches, I might need some more info than the branch name to tell them apart. What is the cleanest way to attach a comment to a new branch? You want branch descriptions: git branch --edit-description This will open up your editor and let you attach metadata to the branch. You can extract it with: git config branch.<branch>.description A couple of important notes: