git-commands

How do I place a dummy file in a git repo?

怎甘沉沦 提交于 2019-12-12 07:58:25
问题 I'm new at git so please bear with me. Say i have a file under version control that includes sensitive data. Sure enough, I put that file in my .gitignore file, so it doesn't get pushed to the repo. The problem now is somewhere in my project i have a line like #include <sensitivedata> or whatever your language of choice is. The problem is whenever somebody clones from that repo, that file is missing and he gets a fatal error when trying to build / compile the solution. So, instead of pushing

How to delete Git tag named starting with dash?

风格不统一 提交于 2019-12-11 11:17:40
问题 I tried deleting the git tag name which is named as -d using command git tag -d -d but couldn't able to delete it. Any ideas? 回答1: git tag -d -- -d is the usual way to tell a *nix program that the argument after -- is not an option but rather a positional argument. This is how you can remove files named -f and so on. 回答2: I had the same issue. git tag -d -- -d did not work for me. However this did work: git tag -d `git tag -l '*-d*'` Explanation: List tags matching *-d* Pass resulting list to

How to rebase my feature branch to development branch in git with least possible conflicts?

微笑、不失礼 提交于 2019-12-10 01:36:46
问题 I have my feature branch which has exceeded around 30 or more commits. Meanwhile in development branch few other features have been pushed from other developers. Therefore, Everytime a new feature is published on development, I am asked to: Rebase development branch onto my feature branch Resolve conflicts if any Continue developing in your feature branch The problem The second step is the chicken's neck here. On rebasing it gives me conflicts for every commit of that branch. This is really

How to rebase my feature branch to development branch in git with least possible conflicts?

无人久伴 提交于 2019-12-05 00:57:39
I have my feature branch which has exceeded around 30 or more commits. Meanwhile in development branch few other features have been pushed from other developers. Therefore, Everytime a new feature is published on development, I am asked to: Rebase development branch onto my feature branch Resolve conflicts if any Continue developing in your feature branch The problem The second step is the chicken's neck here. On rebasing it gives me conflicts for every commit of that branch. This is really iterative and redundant. Note, I can't always rebase the development branch immediately since my own

What is the meaning of the “bang” or “!” before the git command?

孤者浪人 提交于 2019-12-04 23:39:20
As you can see from this excerpt, there is a "!" before the git command. What's the point? [alias] commitx = !git add . && git commit - https://stackoverflow.com/a/8956546/1354543 I understand aliases and what the command itself is doing, but not the point of the "!" before the git command. The ! means "run the following as commands to the shell", so in this case the alias git commitx expands to the equivalent of running git add . && git commit (which is a terrible terrible idea) An important aspect of ! not covered by the accepted answer is that for the shell command, the working directory is

How do I place a dummy file in a git repo?

强颜欢笑 提交于 2019-12-03 13:30:49
I'm new at git so please bear with me. Say i have a file under version control that includes sensitive data. Sure enough, I put that file in my .gitignore file, so it doesn't get pushed to the repo. The problem now is somewhere in my project i have a line like #include <sensitivedata> or whatever your language of choice is. The problem is whenever somebody clones from that repo, that file is missing and he gets a fatal error when trying to build / compile the solution. So, instead of pushing the file I'm actually working on I want to push some dummy file with the same name instead, where I

fatal: No existing author found with 'XXX'

你说的曾经没有我的故事 提交于 2019-12-03 08:58:19
问题 I used git for the first time and I set my user name and user mail. The commands I used are below: git config --global user.email "bob@example.com" git config user.email "bob@example.com" git config --global user.name "bob" git config user.name "bob" When I run git commit --author "bob" , I got an error fatal: No existing author found with 'bob' . How can I set user name and email? 回答1: You should stop using --author each time you commit, and instead configure an author with git config . Once

fatal: No existing author found with 'XXX'

心已入冬 提交于 2019-12-02 21:41:52
I used git for the first time and I set my user name and user mail. The commands I used are below: git config --global user.email "bob@example.com" git config user.email "bob@example.com" git config --global user.name "bob" git config user.name "bob" When I run git commit --author "bob" , I got an error fatal: No existing author found with 'bob' . How can I set user name and email? meagar You should stop using --author each time you commit, and instead configure an author with git config . Once you've done so, you can type git commit and the author will be pulled from your .gitconfig file. If

Does git checkout update all files?

一曲冷凌霜 提交于 2019-12-01 17:59:00
Newb question, I want to make sure I understand this. When I git checkout <revision> , does this return the entire project to its state at that moment, or does it only recreate the files changed in that particular revision? For example: If my folder was completely empty besides the .git repo, and I git checkout master , will the resulting files be the project in its entirety, or only the files changed in the most recent commit? I ask, because I am checking out my project at various points (starting from the beginning), and instead of the project slowly growing in size as one would expect, the

How can I force “git commit -s” using “git commit” command?

℡╲_俬逩灬. 提交于 2019-12-01 14:07:49
I'm looking for a way to write the Signed-off-by: tag automatically when I commit. I tried configuring it through the .git/config file (Reference) . I put these lines of code: [alias] commit = commit -s This did not work. As commented below, you can not edit git's own alias (like commit). (Reference) I also tried using the command (Reference) : git config --global format.signoff true Also had no effect. This explains why. I'm looking for any solution that automatically places the tag and allows me to edit the commit message directly on git, without having to use a system alias. [Edit made