git-branch

GIT: How to keep ignored files when switching branches?

末鹿安然 提交于 2019-11-30 14:20:51
I have an App.Local.config file which each developer has their own settings in. I do not want this file checked versioned in the GIT repo as every time it would be overwritten by another developers changes. So I deleted the file from the repo and added it to the ignore file. But now when developers switch branches, App.Local.config is deleted from their local filesystem. Ultimately what i would like is: new dev clones repo, gets a starting version of App.Local.config dev makes changes to App.Local.config. Git will ignore changes and not stage/checkin dev switches branches, changes to App.Local

How can I color Git branches based on their names?

杀马特。学长 韩版系。学妹 提交于 2019-11-30 13:50:46
I have a number of branches in my local git repository and I keep a particular naming convention which helps me distinguish between recently used and old branches or between merged and not merged with master. Is there a way to color branch names in the output of git branch according to some regexp-based rules without using external scripts? The best I've come up with so far is to run git branch through an external script, and create an alias. However, this may not be very portable... git-branch doesn't let you do that Is there a way to color branch names in the output of git branch according

Get git current branch/tag name

限于喜欢 提交于 2019-11-30 13:10:27
问题 How can I get the current branch or tag name for my working copy? I have seen references that indicate rev-parse --abbrev-ref HEAD will give branch name, but this doesn't work if the checkout is of a tag, in which case it just returns 'HEAD'. I need to somehow get the tag name of these revisions. To be clear, I want one of two possible names: If the current checkout is the HEAD of a branch, I want the branch name If it is a detached HEAD, I want the tag name (on the assumption there is a tag)

Why does Git not store the branch name as part of the commit?

纵然是瞬间 提交于 2019-11-30 12:35:16
Please note : I'm not trying to restart the argument whether Mercurial or Git is better, I just have a technical question that I, as a Mercurial user, don't understand. I'm also not sure whether SO is the right place to ask such a question, but it is programming related. There have been many discussions about how the two version control systems Git and Mercurial differ from each other from a user's point of view (e.g. What is the Difference Between Mercurial and Git? and http://felipec.wordpress.com/2011/01/16/mercurial-vs-git-its-all-in-the-branches/ ), and the major difference is the

Can I enforce a merge-only branch in git?

为君一笑 提交于 2019-11-30 11:09:45
I'm using git, and I'm setting up the following branches to support my workflow: release, which only contains released software, testing, which contains software released to the testing group, develop, which is where development happens, some_topic_branch, where features, etc. get added. Topic branches branch from and get merged into develop. When we're ready for a testing release, testing merges in develop. When a testing release is approved for production, release merges in testing. This is all easy enough to set up, but I'm wondering about the enforcement options in git. For example, is it

Override author on git merge

半腔热情 提交于 2019-11-30 11:08:01
Is there an option like --author of git-commit for git-merge? We maintain a staging environment where some changes must be performed. Some limitations make us to use only one linux user to access staging environment. Anyway, we are a small team with cooperative initiative and we tell when doing commits, which one is the author using the --author git-commit option. However, some times we need to merge from other branches which result in a non-ff merge. This implies a commit is performed when doing this merge. Which would be the best way to specify the author manually for the merge commit in

Get git current branch/tag name

别来无恙 提交于 2019-11-30 11:02:49
How can I get the current branch or tag name for my working copy? I have seen references that indicate rev-parse --abbrev-ref HEAD will give branch name, but this doesn't work if the checkout is of a tag, in which case it just returns 'HEAD'. I need to somehow get the tag name of these revisions. To be clear, I want one of two possible names: If the current checkout is the HEAD of a branch, I want the branch name If it is a detached HEAD, I want the tag name (on the assumption there is a tag) I think you want this: git symbolic-ref -q --short HEAD || git describe --tags --exact-match That will

Initializing private repositories on production server

强颜欢笑 提交于 2019-11-30 10:38:19
What I want to do now is to initialize a private repository on my production server in to app's www folder (ex: /var/www/app.com/web/) and then clone it as a staging repository to my testing site (ex: /var/www/test.com/web/app.com/) and finaly clone from staging to local to work with the code. Am I planning it the right way? I am following these tutorials to learn more about setting the "git server" and initialize private repositories: http://progit.org/book/ch4-4.html https://moocode.com/posts/6-code-your-own-multi-user-private-git-server-in-5-minutes http://www.layeredthoughts.com/git

how does exactly a git merge conflict happen?

走远了吗. 提交于 2019-11-30 10:28:21
问题 I have made a git repository and added a text file to it. This is 100% for learning purpose. I added "1" to the text file and committed it to master. Created a new branch from master and appended "2". Finally, created a branch from master and appended "3". Could you please explain how a conflict may occur in this, or any other, scenario? 回答1: You will have a conflict if you merge: branch2 to master (no conflict) branch3 to master (conflict): That is because: The common ancestor would be

make git branch the master branch

匆匆过客 提交于 2019-11-30 10:10:55
My master branch is so different than my development branch that I would like it to just become my master branch without having to do a merge, is this possible? Seems like I could walk into a lot of work if I just try and do a merge. Jed Schneider If you just have one copy of the repo, you could just delete your master branch, create a new branch from your dev branch called master, but you will have to notify others that you have changed the branch if there are other copies of the repo you don't control. git checkout -b dev git branch -D master git checkout -b master 来源: https://stackoverflow