tagged [git]

What does cherry-picking a commit with Git mean?

What does cherry-picking a commit with Git mean? What does [git cherry-pick ](https://git-scm.com/docs/git-cherry-pick) do?

11 Jul at 05:58

git stash -> merge stashed change with current changes

git stash -> merge stashed change with current changes I made some changes to my branch and realized I forgot I had stashed some other necessary changes to said branch. What I want is a way to merge m...

24 Jun at 12:33

"git rm --cached x" vs "git reset head --​ x"?

"git rm --cached x" vs "git reset head --​ x"? [GitRef.org - Basic](http://gitref.org/basic/): > `git rm` will remove entries from the staging area. This is a bit different from `git reset HEAD` whi...

15 Jan at 04:1

How can I see 'git diff' on the Visual Studio Code side-by-side file?

How can I see 'git diff' on the Visual Studio Code side-by-side file? I would like to know how to see as a file with the command `git diff master origin/master` in the terminal on Visual Studio Code. ...

Link to the issue number on GitHub within a commit message

Link to the issue number on GitHub within a commit message Is it somehow possible to have a link to GitHub issue number in the `git commit` message?

3 Apr at 00:1

Change a branch name in a Git repo

Change a branch name in a Git repo How do I rename an existing branch in a Git repo? I want the current branch to have a new name.

20 Apr at 03:36

How to cherry-pick a range of commits and merge them into another branch?

How to cherry-pick a range of commits and merge them into another branch? I have the following repository layout: - - - What I want to achieve is to cherry-pick a range of commits from the working bra...

23 Aug at 08:31

How to fully delete a git repository created with init?

How to fully delete a git repository created with init? I created a git repository with `git init`. I'd like to delete it entirely and init a new one.

13 Sep at 22:48

How can I undo git reset --hard HEAD~1?

How can I undo git reset --hard HEAD~1? Is it possible to undo the changes caused by the following command? If so, how?

20 Dec at 15:41

How to diff one file to an arbitrary version in Git?

How to diff one file to an arbitrary version in Git? How can I diff a file, say `pom.xml`, from the master branch to an arbitrary older version in Git?

18 Dec at 21:14

How to clone git repository with specific revision/changeset?

How to clone git repository with specific revision/changeset? How can I clone git repository with specific revision, something like I usually do in Mercurial:

31 May at 09:59

Git diff against a stash

Git diff against a stash How can I see the changes un-stashing will make to the current working tree? I would like to know what changes will be made before applying them!

13 Apr at 16:15

How do I "git clone" a repo, including its submodules?

How do I "git clone" a repo, including its submodules? How do I clone a git repository so that it also clones its submodules? Running `git clone $REPO_URL` merely creates empty submodule directories.

17 Jul at 00:43

How can I view a git log of just one user's commits?

How can I view a git log of just one user's commits? When using `git log`, how can I filter by user so that I see only commits from that user?

27 Oct at 13:51

Git submodule push

Git submodule push If I modify a submodule, can I push the commit back to the submodule origin, or would that require a clone? If clone, can I store a clone inside another repository?

28 Feb at 11:45

How to `git pull` while ignoring local changes?

How to `git pull` while ignoring local changes? Is there a way to do a `git pull` that ignores any local file changes without blowing the directory away and having to perform a `git clone`?

25 Oct at 18:0

What's the significance of the "No newline at end of file" log?

What's the significance of the "No newline at end of file" log? When doing a `git diff` it says . What's the significance of the message and what's it trying to tell us?

14 Apr at 19:27

git push --force-with-lease vs. --force

git push --force-with-lease vs. --force I am trying to understand the difference between and My guess is that the latter only pushes to the remote ?

7 Dec at 19:15

How to push a single file in a subdirectory to Github (not master)

How to push a single file in a subdirectory to Github (not master) I have changed a single file in a subdirectory of my repository and I want to push just that file to Github. I've made a small chang...

27 Dec at 01:24

Create a git patch from the uncommitted changes in the current working directory

Create a git patch from the uncommitted changes in the current working directory Say I have uncommitted changes in my working directory. How can I make a patch from those without having to create a co...

22 Aug at 09:32

How can I delete all of my Git stashes at once?

How can I delete all of my Git stashes at once? How can I delete all of my [Git](https://en.wikipedia.org/wiki/Git) stashes at once? Specifically I mean, with typing in one command.

7 Jan at 09:22

How to exit git log or git diff

How to exit git log or git diff I'm trying to learn Git with the help of [Git Immersion](http://gitimmersion.com/). There's one thing that frustrates me whenever I use `git log` or `git diff`: ![Git l...

17 Apr at 17:57

How to pull remote branch from somebody else's repo

How to pull remote branch from somebody else's repo I've got a project hosted on GitHub which somebody has forked. On their fork, they've created a new branch "foo" and made some changes. How do I pul...

Staging Deleted files

Staging Deleted files Say I have a file in my git repository called `foo`. Suppose it has been deleted with `rm` (not `git rm`). Then git status will show: How do I stage this individual file deletion...

10 Feb at 09:40

How can I view an old version of a file with Git?

How can I view an old version of a file with Git? Is there a command in Git to see (either dumped to stdout, or in `$PAGER` or `$EDITOR`) a particular version of a particular file?

16 Jul at 11:30

What is the difference between merge --squash and rebase?

What is the difference between merge --squash and rebase? I'm trying to understand the difference between a squash and a rebase. As I understand it, one performs a squash when doing a rebase.

29 Dec at 00:28

How can I view the Git history in Visual Studio Code?

How can I view the Git history in Visual Studio Code? I can execute various Git commands from Visual Studio Code, however I couldn't find a way to visualize the history.

How to read the output from git diff?

How to read the output from git diff? The man page for `git-diff` is rather long, and explains many cases which don't seem to be necessary for a beginner. For example:

1 Sep at 05:6

Difference between "git add -A" and "git add ."

Difference between "git add -A" and "git add ." What is the difference between [git add [--all | -A]](https://git-scm.com/docs/git-add#Documentation/git-add.txt--A) and [git add .](https://git-scm.com...

10 Jul at 22:26

How do I modify a specific commit?

How do I modify a specific commit? I have the following commit history: 1. HEAD 2. HEAD~ 3. HEAD~2 4. HEAD~3 `git commit --amend` modifies the current `HEAD` commit. But how do I modify `HEAD~3`?

11 Jul at 06:50

git pull error :error: remote ref is at but expected

git pull error :error: remote ref is at but expected

30 Jul at 07:49

Git clone without .git directory

Git clone without .git directory Is there a flag to pass to `git` when doing a clone, say don't clone the `.git` directory? If not, how about a flag to delete the `.git` directory after the clone?

13 May at 23:31

How do I run git log to see changes only for a specific branch?

How do I run git log to see changes only for a specific branch? I have a local branch tracking the remote/master branch. After running `git-pull` and `git-log`, the log will show all commits in the re...

24 Jul at 11:34

How to list only the names of files that changed between two commits

How to list only the names of files that changed between two commits I have a bunch of commits in the repository. I want to see a list of files changed between two commits - from to . What command sho...

26 Aug at 16:55

Undo git update-index --assume-unchanged <file>

Undo git update-index --assume-unchanged I have run the following command to ignore watching/tracking a particular directory/file: How can I undo this, so that `` is watched/tracked again?

10 Mar at 19:29

Set an environment variable in git bash

Set an environment variable in git bash When I punch from the windows gitbash command line: and do : It does not set it to `c`? How can I change/set the value of an environment variable?

9 Dec at 05:12

GitHub - fatal: could not read Username for 'https://github.com': No such file or directory

GitHub - fatal: could not read Username for 'https://github.com': No such file or directory I have the following problem when I try to pull code using git Bash on Windows: I already tried to implement...

1 Sep at 09:4

What's the difference between git switch and git checkout <branch>

What's the difference between git switch and git checkout Git 2.23 [introduces](https://github.com/git/git/blob/master/Documentation/RelNotes/2.23.0.txt) a new command `git switch` -- after reading th...

12 Oct at 06:41

Is there a command to undo git init?

Is there a command to undo git init? I just Git init'ed a repos with a wrong user, and want to undo it. Is there any command for this? Do I actually have to go in and edit the .git directory?

13 Sep at 22:43

Why doesn't Git ignore my specified file?

Why doesn't Git ignore my specified file? I added the following line to `.gitignore`: but when I type `git status` it shows the file as unstaged file. What's the problem? All other patterns work well.

27 Oct at 14:57

Can I make 'git diff' only display the line numbers AND changed file names?

Can I make 'git diff' only display the line numbers AND changed file names? [see this question and answer](https://stackoverflow.com/q/1552340/124486) --- Basically, I don't want to see the changed co...

14 Jun at 11:41

Push commits to another branch

Push commits to another branch Is it possible to commit and push changes from one branch to another. Assume I commited changes in and want to push them to . From , is it valid to do: And then reset BR...

7 Jul at 12:29

git submodule tracking latest

git submodule tracking latest We are moving our (huge) project to git and we are thinking about using submodules. Our plan is to have three different heads in the superproject: > release, stable, late...

30 May at 08:29

Ignore files that have already been committed to a Git repository

Ignore files that have already been committed to a Git repository I have an already initialized Git repository that I added a `.gitignore` file to. How can I refresh the file index so the files I want...

How to fix committing to the wrong Git branch?

How to fix committing to the wrong Git branch? I just made a perfectly good commit to the wrong branch. How do I undo the last commit in my master branch and then take those same changes and get them ...

18 Jul at 07:12

What is difference between 'git reset --hard HEAD~1' and 'git reset --soft HEAD~1'?

What is difference between 'git reset --hard HEAD~1' and 'git reset --soft HEAD~1'? I tried to undo my commit in git. Is it dangerous to use `git reset --hard HEAD~1`? What is the difference between d...

22 Feb at 01:8

How do I undo 'git add' before commit?

How do I undo 'git add' before commit? I mistakenly added files to Git using the command: I have not yet run `git commit`. How do I undo this so that these changes will not be included in the commit?

25 Jul at 02:7

How do I update or sync a forked repository on GitHub?

How do I update or sync a forked repository on GitHub? I forked a project, made changes, and created a pull request which was accepted. New commits were later added to the repository. How do I get tho...

Adding Only Untracked Files

Adding Only Untracked Files One of the commands I find incredibly useful in Git is `git add -u` to throw everything but untracked files into the index. Is there an inverse of that? Such as a way to ad...

9 Jun at 18:50

Why does git say "Pull is not possible because you have unmerged files"?

Why does git say "Pull is not possible because you have unmerged files"? When I try to pull in my project directory in the terminal, I see the following error: ``` harsukh@harsukh-desktop:~/Sites/bran...