From the course: Git for Teams
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Common pitfalls: Force push - Git Tutorial
From the course: Git for Teams
Common pitfalls: Force push
- [Instructor] In this lesson were going to walk through another pitfall so that you can avoid it and stay within the good graces of your team. So, one of the errors you have to be careful when working with Git is using commands you might not be familiar with. One of the most dangerous commands that you can use is the push command with the force flag. This can cause you to overwrite commits and lose some of your work, and it gets a little bit awkward when you overwrite your team member's work. So let's walk through a demonstration so that you can avoid it. OK, so in this scenario, what's going to happen is user two is going to create a new file called demo2. They're then going to add that file to the stage then commit the file. And then push that file to the central repository that the team shares. OK, now at this point, user one wants to make a change to the demo file. So they enter vim, and they're going to add some changes to the demo file. OK, so those changes are in place, and…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
(Locked)
Fundamentals of Git collaboration overview1m 43s
-
(Locked)
Common pitfalls: Untracked pulls4m 27s
-
(Locked)
Common pitfalls: Force push3m 16s
-
Best practices: Committing and syncing3m 29s
-
(Locked)
Best practices: gitignore4m 20s
-
(Locked)
Standardize line endings with autocrlf5m 20s
-
(Locked)
Branch naming1m 46s
-
(Locked)
Write descriptive commit messages6m 29s
-
(Locked)
Team composition and members roles5m 33s
-
(Locked)
-
-
-
-