git-branch

git branching - how to make current master a branch and then revert master back to previous version?

自闭症网瘾萝莉.ら 提交于 2019-12-03 08:40:24
This is probably quite simple but I'm currently a git noob and haven't quite got my head round the git branching model yet. Suppose I currently have no branches other than master , but now I've made some changes since my last commit that I've decided I don't want to keep (note: the changes are not committed yet). I don't want to get rid of these changes just yet though - I'd like to put them in their own branch (called e.g. experimental_stuff ) and then continue development from my previous commit. So I guess the steps are: make current master a branch ( git branch experimental_stuff ?) go

How can I get a list of Git branches that I've recently checked out?

佐手、 提交于 2019-12-03 08:30:08
问题 When moving between Git branches I sometimes forget the name of a branch I was recently on. How can I display a list of recently checked out branches/tags/commits? 回答1: Summary: You can use Git's reflog to show recent movements: git reflog Script: Here's a script you can download and use via git recent from inside any Git repository: https://gist.github.com/jordan-brough/48e2803c0ffa6dc2e0bd Details: Here's essentially what the script does to make the reflog output more usable: $ git reflog |

What is a “branch tip” in Git?

巧了我就是萌 提交于 2019-12-03 08:27:55
问题 I'm learning Git and reading the Pro Git book. The term "branch tip" is used sometimes in the book and also here on Stack Overflow, but I can't find the meaning of it. 回答1: A branch tip is the last commit or most recent commit on a branch. Basically it points to the most up to date code in the branch. 回答2: Using an image from the Pro Git book to illustrate: master , hotfix and iss53 are all "branch tips" here. Kevin's answer is correct, but this might be easier to understand for beginners. 来源

Add new commit to the existing Git tag

孤街浪徒 提交于 2019-12-03 08:24:29
问题 I have created a Git tag as v1.1 using git tag -a v1.1 -m 'my version 1.1' and I pushed that tag. Later, I made some changes related to v1.1 . Now when I push new changes and check the git tag using git describe it is showing me v1.1-g2dcc97 . How can I add my new commit to the existing tag? 回答1: You can't put a new commit into an existing tag without breaking an important Git guideline: Never(*) modify commits that you have published. Tags in Git aren't meant to be mutable. Once you push a

Is there a simple command to convert a branch to a tag?

半城伤御伤魂 提交于 2019-12-03 08:19:35
问题 I am about to complete a tedious process of converting "dumb snapshots" to git. This process has been going very well (thanks to this rename process), but now I realized that some of the branches that I created, do not merit a branch but rather a tag . Since everything is still local (never pushed to a repository), I found this question (and associated answer) somewhat more cumbersome than I prefer, so I was wondering whether I can take a shortcut via some simple "convert-from-branch-to-tag"

How to do a “git checkout -b <branchname>” from a remote tag

烈酒焚心 提交于 2019-12-03 08:14:39
问题 I'm trying to create a branch from a remote tag, but it seems there's no way to do it. When I try git checkout -b test origin/deploy where origin is the remote and deploy is the tag I want to check out, but I get fatal: git checkout: updating paths is incompatible with switching branches. Did you intend to checkout 'origin/deploy' which can not be resolved as commit? UPDATE: I've just discovered that git fetch --all -t was not working properly for me. While it downloads all branches, it does

opening .git/config : Permission denied

允我心安 提交于 2019-12-03 08:10:30
C:\Users\Inspiron\.git\config folder is empty and command $git config user.email user@gmail.com returns error: opening .git/config: permission denied. I try to set post buffer size,but get same error. Thats not a folder its the main configuration file for git. Here you can see the files for configuration http://git-scm.com/docs/git-config Permission denied under windows its a bit strange. Check the permissions of the file. Perhaps you have removed the Permissions in the extended permissions. I'm pretty sure it's not supposed to be a folder. Delete it and let git create it. Check Windows

How to update a file across all branches in a Git repository

戏子无情 提交于 2019-12-03 07:18:16
In the case that a a repository has a number of branches: How does one simply update a file across all the branches. In this case it's a bashrc like file that specifies some environments variables. I have in the past updated the master branch version then rebased each branch. This has a sort of n+1 overhead, I'd like to avoid. I think, it is bit late but following script will help you in this. #!/bin/bash if [ $# != 1 ]; then echo "usage: $0 <filename>" exit; fi branches=`git for-each-ref --format='%(refname:short)' refs/heads/\*` curr_branch=`git rev-parse --abbrev-ref HEAD` # echo "curr

Why doesn't the graph display a new branch branching off from the master branch, when I create a new branch in terminal?

自作多情 提交于 2019-12-03 06:59:50
问题 Why doesn't the graph in Sourcetree display a new branch branching off from the master branch , when I create a new branch called "testing123" in terminal ? Sourcetree recognises the new branch but it doesn't branch off from the master branch in the graph. Why is this happening ? How can I make Sourcetree graph display the new branch branching off from master? 回答1: It does: it has one new commit done from master . That means you have checked out the new branch testing123 , done one commit and

git — locking master branch for some users?

北城以北 提交于 2019-12-03 06:50:13
问题 I would like to force other team-members to not work on the master-branch but on a development branch. we have a central git-repository where we push our work into. i would like to know if it's possible to block users from pushing changes to the master-branch but only allow certain users to do so. I would like to have the following "workflow" development is always only done with a development-branch the release-manager is responsible for the master branch and only he is allowed to merge stuff