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:

16629 questions
24007
votes
98 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? The only way seems to be to copy the edits in some kind of GUI text editor, then wipe the whole…
Hamza Yerlikaya
  • 48,189
  • 40
  • 139
  • 234
18976
votes
41 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
  • 424,668
  • 38
  • 118
  • 160
13061
votes
38 answers

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

What are the differences between git pull and git fetch?
pupeno
  • 264,618
  • 120
  • 339
  • 573
10241
votes
36 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 repository? In case you need to rename a remote branch as…
Forrest
  • 111,363
  • 20
  • 71
  • 107
8512
votes
48 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
  • 90,015
  • 10
  • 37
  • 51
5616
votes
37 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
  • 321,454
  • 105
  • 202
  • 204
5220
votes
34 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_
  • 62,079
  • 6
  • 30
  • 37
2957
votes
15 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
  • 30,771
  • 6
  • 24
  • 21
2703
votes
40 answers

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

I was writing a simple script on the school computer, and committing the changes to Git (in a repo that was in my pen drive, cloned from my computer at home). After several commits, I realized I was committing stuff as the root user. Is there any…
2683
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,999
  • 11
  • 36
  • 44
2309
votes
48 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
  • 34,151
  • 9
  • 28
  • 34
2067
votes
13 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
  • 40,135
  • 57
  • 96
  • 147
1978
votes
23 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
  • 51,705
  • 16
  • 123
  • 156
1948
votes
16 answers

When do you use Git rebase instead of Git merge?

When is it recommended to use Git rebase vs. Git merge? Do I still need to merge after a successful rebase?
Coocoo4Cocoa
  • 44,746
  • 50
  • 149
  • 175
1860
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
  • 31,930
  • 10
  • 52
  • 68
1
2 3
99 100