Use the Pomodoro technique
This means work for 20-25 minutes and then take a 5 minute break. This means you don't have to commit to getting the work done but you have to just commit to 20 minutes. More often than not, you will want to continue working after the 20 minute mark. You can also use apps to implement this technique in your daily life. Or you can use a physical time.
Seek help when stuck
When you have a bug or an error which you are not able to solve, try explaining it to someone else. More often than not, just explaining the problem to someone else might help you reach a solution. If not, the other person might be able to help. But beware to not interrupt other people's work all the time with your bugs, first try to solve it yourself.
Code with someone else
Maybe meet up with a friend and both of you do your own coding work. This way, you might be able to feel more motivated since you can see someone else coding too and this will give you a boost of motivation. You both can also try to learn new technological things together.
Listen to music
I don't know if this works for everyone but try to listen to music while coding. This might put you in the flow and also keep you entertained.
Seek feedback
Get your code reviewed regularly and get your designs reviewed too. This will give you a second perspective on your work and it will open room for improvement in your product and your code.
Push your code!
Aim to do at least one meaningful push everyday. This makes it easier for you to measure if you were productive on that day or not. And let's be honest, it is true that what gets measured, gets managed.