Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,455,617
Community Members
 
Community Events
175
Community Groups

question about git push

I'm looking at the tutorial on `git push` at https://www.atlassian.com/git/tutorials/syncing/git-push#:~:text=The%20git%20push%20command%20is,exports%20commits%20to%20remote%20branches.

I'm confused by the following paragraph:

"Push the specified branch to , along with all of the necessary commits and internal objects. This creates a local branch in the destination repository. To prevent you from overwriting commits, Git won’t let you push when it results in a non-fast-forward merge in the destination repository."

Firstly, something is missing after the word "to".  Secondly, what is meant by the term non-fast-forward merge?

 

2 answers

1 accepted

2 votes
Answer accepted

Hi Philip, welcome to the community!

I understand you need some clarification on 'git push'.

I think the sentence should be like "Push the specified branch to the remote repository, along with all of the necessary commits and internal objects. This creates a local branch in the remote destination repository ...."

Fast forward push

When you work on a git branch and commit code on your local branch, you need to push your work to the remote branch (in bitbucket) to be able to share it with others or create a pull request. Ideally nobody else should be committing and pushing to your working branch. Then every change you commit and push is a direct successor of the previous change. That's called a fast-forward (push) merge.

Non-fast-forward push

If someone else 'interfered' with your branch and pushed 'their' changes to the remote before you pushed yours, your update is not fast-forward any longer, since the last commit is from someone else, but your new commit is based on an earlier stage of the branch. You are in a little bit of trouble now because you need to update your local branch with the 'alien' commit from someone else to merge their and your work before you can push the result, i.e. your work and 'their' work combined, back to Bitbucket (remote).

Conclusion

1. Don't work on shared branches, complete your feature on your branch

2. Run 'git pull' before your commit local changes. It doesn't hurt and in case someone else interfered with your remote branch you are updating your local branch

3. Commit your changes

4. Safely push your changes to remote, they will always be a fast-forward (push) merge in the remote.

Hope that helps!

Ulrich

// Izymes - Bitbucket apps for efficient teams

0 votes

Hi @phillip_feldman - Thank you for bringing this to our attention. We will get the content you mentioned updated and edited accordingly ASAP. Cheers

 

@Ulrich Kuhnhardt _IzymesCo_ - Thank you for providing such a thorough and thoughtful answer. Much appreciated. 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS

Atlassian Community Events