Questions tagged [version-control]

Version control is the management of changes to documents, programs, and other information stored as computer files. Use this tag to mark general questions about usage and applicability of version control, VCS comparison. For most commands and techniques specific to each particular VCS there are specific tags, which should be preferred.

Version control, also known as revision control, source control or software configuration management (SCM), is the management of changes to documents, programs, and other information stored as computer files. It is most commonly used in software development, where a team of people may change the same files.

For questions specific to a certain version control software use the appropriate tag. Here is an (incomplete) list of commonly used tags:

16286 questions
22674
votes
92 answers

How do I undo the most recent local commits in Git?

I accidentally committed the wrong files to Git, but didn't push the commit to the server yet. How can I undo those commits from the local repository?
Hamza Yerlikaya
  • 47,689
  • 37
  • 135
  • 231
17987
votes
39 answers

How do I delete a Git branch locally and remotely?

I want to delete a branch both locally and remotely. Failed Attempts to Delete a Remote Branch $ git branch -d remotes/origin/bugfix error: branch 'remotes/origin/bugfix' not found. $ git branch -d origin/bugfix error: branch 'origin/bugfix' not…
Matthew Rankin
  • 400,554
  • 38
  • 116
  • 156
12539
votes
38 answers

What is the difference between 'git pull' and 'git fetch'?

What are the differences between git pull and git fetch?
pupeno
  • 256,034
  • 114
  • 324
  • 541
9328
votes
34 answers

How do I rename a local Git branch?

I don't want to rename a remote branch, as described in Rename master branch for both local and remote Git repositories. How can I rename a local branch which hasn't been pushed to a remote branch? In case you need to rename remote branch as…
Forrest
  • 101,971
  • 19
  • 69
  • 107
8002
votes
50 answers

How do I force "git pull" to overwrite local files?

How do I force an overwrite of local files on a git pull? The scenario is the following: A team member is modifying the templates for a website we are working on They are adding some images to the images directory (but forgets to add them under…
Jakub Troszok
  • 84,701
  • 10
  • 36
  • 49
5257
votes
36 answers

How do I discard unstaged changes in Git?

How do I discard changes in my working copy that are not in the index?
readonly
  • 306,152
  • 101
  • 198
  • 201
4913
votes
33 answers

How can I reset or revert a file to a specific revision?

I have made some changes to a file which has been committed a few times as part of a group of files, but now want to reset/revert the changes on it back to a previous version. I have done a git log along with a git diff to find the revision I need,…
Hates_
  • 58,801
  • 6
  • 28
  • 37
2795
votes
13 answers

I ran into a merge conflict. How can I abort the merge?

I used git pull and had a merge conflict: unmerged: _widget.html.erb You are in the middle of a conflicted merge. I know that the other version of the file is good and that mine is bad so all my changes should be abandoned. How can I do this?
Gwyn Morfey
  • 29,133
  • 6
  • 23
  • 21
2615
votes
21 answers

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 ignored get ignored?
trobrock
  • 44,089
  • 11
  • 35
  • 44
2565
votes
37 answers

How to change the author and committer name and e-mail of multiple commits in Git?

I was writing a simple script in the school computer, and committing the changes to Git (in a repo that was in my pendrive, cloned from my computer at home). After several commits I realized I was committing stuff as the root user. Is there any way…
2152
votes
47 answers

How can I delete all Git branches which have been merged?

I have many Git branches. How do I delete branches which have already been merged? Is there an easy way to delete them all instead of deleting them one by one?
Nyambaa
  • 31,433
  • 9
  • 27
  • 34
1801
votes
21 answers

How can I see the changes in a Git commit?

When I do git diff COMMIT I see the changes between that commit and HEAD (as far as I know), but I would like to see the changes that were made by that single commit. I haven't found any obvious options on diff / log that will give me that output.
laktak
  • 47,916
  • 15
  • 112
  • 150
1798
votes
12 answers

Do I commit the package-lock.json file created by npm 5?

npm 5 was released today and one of the new features include deterministic installs with the creation of a package-lock.json file. Is this file supposed to be kept in source control? I'm assuming it's similar to yarn.lock and composer.lock, both of…
rink.attendant.6
  • 36,468
  • 57
  • 89
  • 143
1771
votes
14 answers

Undo working copy modifications of one file in Git?

After the last commit, I modified a bunch of files in my working copy, but I want to undo the changes to one of those files, as in reset it to the same state as the most recent commit. However, I only want to undo the working copy changes of just…
hasen
  • 148,751
  • 62
  • 182
  • 223
1754
votes
4 answers

How does Git handle symbolic links?

If I have a file or directory that is a symbolic link and I commit it to a Git repository, what happens to it? I would assume that it leaves it as a symbolic link until the file is deleted and then if you pull the file back from an old version it…
Alex
  • 30,072
  • 10
  • 51
  • 67
1
2 3
99 100