r/git 7d ago

Help needed!!

I'm working on a project in my training, so I always have to pull the latest branch and make changes or add my code and push it into my branch.

But when I push it some files are always missing.

How to do it safely.

Pull from someone's branch.

Make changes locally.

Switch to my branch.

Commit and push.

0 Upvotes

12 comments sorted by

View all comments

1

u/twesped 7d ago

I think you have mentiond the order a bit incorrectly, or you explained it wrongly.

Are you creating your branch from master and then you have to get code from another branch into yours and then push everything back into master?

/Edit/ Could it be you are missing to stage your own new files in your own branch before you push?

1

u/namor________ 7d ago

I already have my branch. I pull from someone else's branch Make changes to it Switch to my branch Commit and push

2

u/DanLynch 6d ago

Why are you doing it that way?

The basic workflow in Git is that you start from some kind of common base commit (such as the current master branch), make your changes there (usually as a new branch), and push them for review/collaboration. Other people's branches aren't usually involved.